Using single field geocoding, (ArcGIS REST API) I am having an issue with the World Geocoding Service when it comes to getting results that include both USA and US territories, like Puerto Rico for example.


http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/findAddressCandidates?find=puerto rico&SingleLine=puerto rico&sourceCountry=USA&f=json&outFields=Loc_name&callback=esriDojo.io.script.jsonp_esriDojoIoScript10._jsonpCallback

In the geocode request string above, I am limiting results to USA only ('sourceCountry=USA'), however I get a result that doesn't include Puerto Rico (the commonwealth) - only Puerto Rico, Texas. This is the same if I change my search parameter to "San Juan" - I would like to get San Juan, PR as a result, along with the rest of the 'San Juan' location in CONUS.

Esri Help states that you can limit the 'sourceCountry' parameter to "USA" for only results in the US, but problematically this means CONUS, not Puerto Rico or other "US" territories like Virgin islands, Mariana Islands, etc.

Esri also has a specific country code geocode limiter for Puerto Rico (PRI) however I cannot find a way to combine this with (USA) into one request which would limit return results to only USA, PRI together. It seems to allow one country code per request, currently.

Since this is a web map focused solely on USA and territories, with full extent set to CONUS (including PR and Hawaii), it doesn't make sense for me to remove the 'sourceCounty' parameter altogether. We don't want international results to come up (and they will) since the results are typically ordered by total population.

Can anyone recommend a different approach (or updated geocode string) to limiting the results to only USA and Puerto Rico? Is there a way to combine multiple 'sourceCountry" parameters to account for USA & PRI into one geocode request?

Thanks in advance

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.