Select to view content in your preferred language

Bug in how the reverseGeocode endpoint handles 'location', or is documentation wrong?

726
5
Jump to solution
10-11-2024 12:35 PM
Labels (1)
Trippetoe
Frequent Contributor

Hi. The documentation for the ArcGIS REST API reverseGeocode operation says that the `location` parameter can take one of three forms:

  1. location=103.8767227,1.3330736
  2. location={x: 103.876722, y: 1.3330736}
  3. location={ "x": 11563503, "y": 148410, "spatialReference": { "wkid": 3857 } }

In my testing, only the first option works. Option 2 and 3 return 'Error occurred while processing request' with no error message and a description 'http.400'

For my testing, i'm using the URL from the Examples within the documentation page, and switching out the various options for `location` and dropping the 'token' parameter. Like this:

https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/reverseGeocode?f=pjson&featureTypes=&location=-117.205525,34.038232
https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/reverseGeocode?f=pjson&featureTypes=&location={x:103.876722,y:1.3330736}
https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/reverseGeocode?f=pjson&featureTypes=&location={ "x": 11563503, "y": 148410, "spatialReference": { "wkid": 3857 } }

Only the top one is successful. Is the documentation off, or is there a bug in the reverseGeocode endpoint?

Thank you.

0 Kudos
1 Solution

Accepted Solutions
rcGIS
by
Frequent Contributor

Hello @Trippetoe, I don't think I will be able to help you further. 

Still, after a quick research, I found three 'somehow relevant' old Esri Community posts that you might want to look at: 1, 2, and 3. And I also see that the ArcGIS Geocoding Service was updated in September; maybe there was some undocumented change? 

I would be curious to know the solution. Good luck!

View solution in original post

5 Replies
rcGIS
by
Frequent Contributor

Hello @Trippetoe,

Did you review if the syntax of your 2nd and 3rd requests match exactly the Esri documentation examples? I seem to see some minor space differences. I'm not sure if those might make a difference, but I would check since you get a 400 error message.

0 Kudos
Trippetoe
Frequent Contributor

Hi @rcGIS . Thanks for taking a look at my question.

I reviewed the requests, and I feel pretty good about the syntax. I reran the second one with an exact copy / paste. The browser did its URL encoding with a final URL of https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/reverseGeocode?location={x:%2010.... I got the same response http.400 'Error occurred while processing result

0 Kudos
rcGIS
by
Frequent Contributor

Hello @Trippetoe, I don't think I will be able to help you further. 

Still, after a quick research, I found three 'somehow relevant' old Esri Community posts that you might want to look at: 1, 2, and 3. And I also see that the ArcGIS Geocoding Service was updated in September; maybe there was some undocumented change? 

I would be curious to know the solution. Good luck!

Trippetoe
Frequent Contributor

Thanks @rcGIS . The three links you provided were helpful. They sent me down the path of getting to know online URL encoders a bit more than i had known them before. Eventually, i stumbled on an encoded URL that seemed to do the trick (for example, this is the third link in my original post fully encoded):  

https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/reverseGeocode?f=pjson&featureTy...

That request got me a valid response from the service. I'm gonna call that a win, and move on. 

Thanks again for your help

 

0 Kudos
rcGIS
by
Frequent Contributor

I'm glad I could be of some assistance, @Trippetoe. Thank you for sharing those additional details, too.

0 Kudos