mapbox / mapbox-maps-flutter

Interactive, thoroughly customizable maps for Flutter powered by Mapbox Maps SDK
https://www.mapbox.com/mobile-maps-sdk
Other
245 stars 93 forks source link

Whats the easiest way to draw an area of influence around a point? lets say draw a circle 5000 meters radius around those coordinates? #503

Open ember11498 opened 4 weeks ago

ember11498 commented 4 weeks ago

lets say I have this coordinates lat: 39, lon: -9.

How can I draw something like this?

image

or this:

image

maios commented 3 weeks ago

Hi @ember11498, you can add a CircleAnnotation at the given coordinate to achieve what you want, please take a look at this example

ember11498 commented 3 weeks ago

@maios thank you for the reply. But can I make the circle 5km radius from my coordinates? Does it have that parameter? it has a circleRadius parameter but isnt that in pixels?

Cannot see anywhere explicitly saying what exactly is the circleRadius. meters? km? pixels?

maios commented 3 weeks ago

my bad, we are indeed lack of documentation on this SDK on that part, we will add it as soon as we can. Anyway, the unit of circle-radius is in pixels as stated in this style-spec Our CircleAnnotationsManager unfortunately do not support Expressions, they only support values as constant for now. You can however use low-level Style API to add a layer and set its layer properties to the style. However, with your use case the expression will be quite tricky, we have a similar example in iOS where we calculate the radius based on zoom level here