Follow https://docs.mapbox.com/android/maps/guides/install/ to set up the Maps SDK and add a basic map to your Android app.
https://docs.mapbox.com/android/maps/examples/draw-a-polygon/ shows how to draw polygons on the map. This is if you have the coordinates only on the device.
You could use the Mapbox dataset editor + https://studio.mapbox.com/datasets , to draw the polygons instead. Then export the dataset to a vector tileset and then reference the tileset in a Maps SDK VectorSource
https://github.com/mapbox/mapbox-android-demo/search?q=VectorSource
No matter how you add the data to the map, you'll want to do the additions in a separate method if you'll be switching map styles on the fly. After the style is successfully changed and loaded, re-add the data/layers.
You could use multiple GeoJSON Polygon
objects or a single GeoJSON MultiPolygon
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.