Select to view content in your preferred language

Reverse Geocode API confusion

542
3
11-01-2023 09:38 AM
Labels (4)
BjørnarSundsbø1
Occasional Contributor II

LocatorTask.ReverseGeocodeAsync has a method that takes a parameter that has ReverseGeocodeParameters.MaxResult that the documentation says the WorldGeocodeService can return up to 20 results per request. The return value of this method is an IReadOnlyList of GeoCodeResult. This leads me to believe that I can request more than one hit within a radius.

However, looking at the request through Fiddler, the maxResult is not passed in the request parameters. The documentation for the Rest API for reverseGeocode doesn't indicate that the result can ever be a list of addresses, or that MaxResult is an available parameter. Is there a mismatch between the implemented SDK API and the REST API, or is it more future proof?

We have many configured Geocode services (doing direct query against featurelayers is rather cumbersome as everything is ideally supposed to be configured in the portal. We want to query "What's near this location?", and we need multiple results per service as the MaxResult property says.

Are there good workarounds for this, or alternative geocode API? findAddressCandidates (LocatorTask.Geocode, I presume) with location might be an option, but I've not seen samples on how to send just a position to get multiple addresses, but that could be a combination with SearchArea and some additional parameters to get within a radius?

0 Kudos
3 Replies
BjørnarSundsbø1
Occasional Contributor II

@dotMorten is this something you have experience with?

0 Kudos
dotMorten_esri
Esri Notable Contributor

Sorry no I don't remember the reason for this. However the geocode task can work with many different services as well as local offline datasets, where each could have different capabilities.

0 Kudos
BjørnarSundsbø1
Occasional Contributor II

Thank you for getting back to me. The geocode services we are searching against are custom proxies, which might be tailored to provide multiple results, however, since the maxresult parameter is never passed to the service, it is tricky to tell it how many results to return. Rewriting it to return multiple results might be possible, however it is unknown what format to return to be able to support multiple results that the Maps SDK is able to process successfully. I.e. "What's here" functionality with multiple results per geocodeService.

Can you think of other ways to get multiple results from a geocode service based on a location only, and still follow specifications?

0 Kudos