简体   繁体   中英

How to create a custom Air map view and draw a polygon using map box in android application

I am using the map box SDK in which I have to set different map types. Mostly I have to use an air map view using map box SDK. I want to implement a view like the below image.

在此处输入图像描述

How would I achieve a view and also how to draw a polygon like this image?

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM