AnsweredAssumed Answered

countryCode property not honored by Locator task at 3.11?

Question asked by eliprandi on Feb 19, 2015

We are using the Locator task on the JavaScript API (v3.11). According to the documentation for addressToLocations (Locator | API Reference | ArcGIS API for JavaScript ) the countryCode can be specified on the locator itself, as a property (Locator | API Reference | ArcGIS API for JavaScript ). However, it does not seem to be added to the request. So, the following:

var locator = new esri.tasks.Locator("//geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer");
locator.outSpatialReference = localRef;
locator.countryCode = 'AU';
locator.addressToLocations({ address: { 'SingleLine': 'sidney' } }, function(candidates) {/*...*/})

 

will return Sidney, Australia, as well has dozens of other Sidney.

 

However, if we add the countryCode directly to the addressToLocations parameters, we get the expected result, with only Sidney Australia as follows:

var locator = new esri.tasks.Locator("//geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer");
locator.outSpatialReference = localRef;
locator.addressToLocations({ address: { 'SingleLine': 'sidney' }, countryCode : 'AU' }, function(candidates) {/*...*/})

 

The outSpatialReference is used properly.

 

What are we missing?

 

We tried 3.12 and got the same results.

 

I have created a Plunker to show this issue.

Outcomes