How do you prevent a white background when moving map beyond area included in mbtiles file? #383
-
Hi, I have a small geographical area of an island surrounded by water as an mbtiles file. When I move the map beyond the area included in the mbtiles file, Alternatively, is there a way to prevent the user from moving the map beyond the area included in the mbtiles file? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 8 replies
-
You can add a layer to the bottom of the map, for example for a solid red background: MapLibreMap(...) {
Anchor.Bottom {
BackgroundLayer(id = "custom-bg", color = const(Color.Red)
}
}
I think transparent isn't possible due to how Compose and platform views interop on Android and iOS.
Not trivially yet, it's a planned feature. See #20. But you could use the |
Beta Was this translation helpful? Give feedback.
Looking at the OpenMapTiles schema (used by MapTiler) looks like they don't provide polygons for land. So it probably won't be possible with this data.
An alternative:
rememberGeoJsonSource()
with the geometry of the area you want to paint a particular color, and pass it to aFillLayer
above the background, below everything else. Something like:Or, do the opposite; keep the original background, and paint the out of bounds area some color:
val outside…