mapbox / mapbox-maps-ios

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

Create CircleLayers with a Physical Unit Radius #2178

Open seizler opened 6 months ago

seizler commented 6 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 6 months 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)