Your Location is: Home > Flutter

Reverse Geocoding Mapbox results

From: Malawi View: 2926 Wayne Johnson 

Question

When getting results from Mapbox API for the reverse geocoding results, I get only one specific result returned. Is there a way to increase the results returned, say for a larger radius around the reverse geocoded point? If a user clicks on a map, I'd like to give them options to choose from several places/addresses that are close to where they clicked, in case the spot they touched on the map isn't exactly correct.

Best answer

Is there a way to increase the results returned, say for a larger radius around the reverse geocoded point?

Yes. According to Mapbox's Reverse Geocoding API, you can try changing the limit, type and reverseMode parameters. You can play around with that in the API Playground.

You can't directly control the radius, and the max limit is 5, but take a hard look at type: since you're concerned with "misclicks", but your application doesn't need the location down to address, but maybe just down to "neighborhood", or "postcode" level, if you set type appropriately you may not need to worry about the exact click location too much. So, basically, setting type as a higher-level locality type and increasing limit, you're effectively increasing the radius.

I don't think however Mapbox has an official Flutter SDK, so you might have to talk with the APIs yourself, though.