<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic countryCode property not honored by Locator task at 3.11? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/countrycode-property-not-honored-by-locator-task/m-p/270137#M24874</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We are using the Locator task on the JavaScript API (v3.11). According to the documentation for &lt;EM&gt;addressToLocations&lt;/EM&gt; (&lt;A href="https://developers.arcgis.com/javascript/jsapi/locator-amd.html#addresstolocations" title="https://developers.arcgis.com/javascript/jsapi/locator-amd.html#addresstolocations" rel="nofollow noopener noreferrer" target="_blank"&gt;Locator | API Reference | ArcGIS API for JavaScript&lt;/A&gt; ) the &lt;EM&gt;countryCode&lt;/EM&gt; can be specified on the locator itself, as a property (&lt;A href="https://developers.arcgis.com/javascript/jsapi/locator-amd.html#countrycode" title="https://developers.arcgis.com/javascript/jsapi/locator-amd.html#countrycode" rel="nofollow noopener noreferrer" target="_blank"&gt;Locator | API Reference | ArcGIS API for JavaScript&lt;/A&gt; ). However, it does not seem to be added to the request. So, the following:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;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) {/*...*/})&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;will return Sidney, Australia, as well has dozens of other Sidney.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, if we add the countryCode directly to the addressToLocations parameters, we get the expected result, with only Sidney Australia as follows:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;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) {/*...*/})&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The &lt;EM&gt;outSpatialReference&lt;/EM&gt; is used properly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What are we missing?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We tried 3.12 and got the same results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have created a &lt;A href="http://plnkr.co/edit/J6NV4K?p=preview" title="http://plnkr.co/edit/J6NV4K?p=preview" rel="nofollow noopener noreferrer" target="_blank"&gt;Plunker&lt;/A&gt; to show this issue.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 13:12:44 GMT</pubDate>
    <dc:creator>ericliprandi</dc:creator>
    <dc:date>2021-12-11T13:12:44Z</dc:date>
    <item>
      <title>countryCode property not honored by Locator task at 3.11?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/countrycode-property-not-honored-by-locator-task/m-p/270137#M24874</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We are using the Locator task on the JavaScript API (v3.11). According to the documentation for &lt;EM&gt;addressToLocations&lt;/EM&gt; (&lt;A href="https://developers.arcgis.com/javascript/jsapi/locator-amd.html#addresstolocations" title="https://developers.arcgis.com/javascript/jsapi/locator-amd.html#addresstolocations" rel="nofollow noopener noreferrer" target="_blank"&gt;Locator | API Reference | ArcGIS API for JavaScript&lt;/A&gt; ) the &lt;EM&gt;countryCode&lt;/EM&gt; can be specified on the locator itself, as a property (&lt;A href="https://developers.arcgis.com/javascript/jsapi/locator-amd.html#countrycode" title="https://developers.arcgis.com/javascript/jsapi/locator-amd.html#countrycode" rel="nofollow noopener noreferrer" target="_blank"&gt;Locator | API Reference | ArcGIS API for JavaScript&lt;/A&gt; ). However, it does not seem to be added to the request. So, the following:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;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) {/*...*/})&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;will return Sidney, Australia, as well has dozens of other Sidney.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, if we add the countryCode directly to the addressToLocations parameters, we get the expected result, with only Sidney Australia as follows:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;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) {/*...*/})&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The &lt;EM&gt;outSpatialReference&lt;/EM&gt; is used properly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What are we missing?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We tried 3.12 and got the same results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have created a &lt;A href="http://plnkr.co/edit/J6NV4K?p=preview" title="http://plnkr.co/edit/J6NV4K?p=preview" rel="nofollow noopener noreferrer" target="_blank"&gt;Plunker&lt;/A&gt; to show this issue.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 13:12:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/countrycode-property-not-honored-by-locator-task/m-p/270137#M24874</guid>
      <dc:creator>ericliprandi</dc:creator>
      <dc:date>2021-12-11T13:12:44Z</dc:date>
    </item>
  </channel>
</rss>

