mapbox / mapbox-maps-ios

Interactive, thoroughly customizable maps for iOS powered by vector tiles and Metal
https://www.mapbox.com/mapbox-mobile-sdk
Other
451 stars 148 forks source link

Create CircleLayers with a Physical Unit Radius #2178

Open seizler opened 2 months ago

seizler commented 2 months ago

New Feature

Instead of screen units that change scale with the zoom of the map, please add the ability to define the circle radius in units such as meters or feet or miles or whatever. I need to encompass a certain radius around my features on the map and am having a hard time.

Why

This solves so much headache of converting a point feature geojson into a massive amount of coordinates to draw a fill layer perimiter.

persidskiy commented 1 month ago

@seizler Hi, a way to go here is to create a polygon with Turf and use the fill layer. https://mapbox.github.io/turf-swift/2.8.0/Structs/Polygon.html#/s:4Turf7PolygonV6center6radius8verticesACSo22CLLocationCoordinate2DV_SdSitcfc

// The radius is in meters here
let polygon = Polygon(center: coord, radius: 10000, vertices: 30)