<?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 Geocode Table using Esri World Geocode via Python Script in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/geocode-table-using-esri-world-geocode-via-python/m-p/694438#M53847</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is it possible to geocode a table using the Esri World Geocoder in a stand alone script using Pro and the function&amp;nbsp;&lt;CODE&gt;arcpy.GeocodeAddresses_geocoding&lt;/CODE&gt;?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I'm in Pro and use this tool, and use the Esri World Geocoder we have as an item in our Portal (with an AGO user credentials stored), I can successfully geocode the table as expected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I try writing a stand-alone Python script, it fails every time, and I'm really not sure what I'm doing wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below is a sample of my code:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;# portal variables&lt;/SPAN&gt;
portalUrl &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'...our AGO for Organizations URL...'&lt;/SPAN&gt;
portalUser &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'...userName...'&lt;/SPAN&gt;
portalPassword &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'...userPassword...'&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# geocode variables&lt;/SPAN&gt;
geocodeTable &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'...path to table containing addresses...'&lt;/SPAN&gt;
geocodeUrl &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;'https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer'&lt;/SPAN&gt;
OR
geocodeUrl &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;'...url to our Portal item referencing the Esri World Geocoder with AGO credentials stored...'&lt;/SPAN&gt;
geocodeFieldMap &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Address SiteAddress;City SiteCity;Region SiteState;Postal SiteZip'&lt;/SPAN&gt;
geocodeOutput &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'...path to output feature class...'&lt;/SPAN&gt;

arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SignInToPortal&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;portalUrl&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; portalUser&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; portalPassword&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;GeocodeAddresses_geocoding&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;geocodeTable&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; geocodeUrl&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; geocodeFieldMap&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; geocodeOutput&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; None&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; None&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; None&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; None&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I seem to always get this error:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid.&lt;BR /&gt;ERROR 000005: Could not open the address locator.&lt;BR /&gt;Failed to execute (GeocodeAddresses).&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have also tried using &lt;CODE&gt;arcgis.geocoding.batch_geocode&lt;/CODE&gt; ... but this doesn't preserve any of the other attributes within the table, other than the address information used to locate the point, which is pointless for what we're trying to accomplish.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 05:13:35 GMT</pubDate>
    <dc:creator>mpboyle</dc:creator>
    <dc:date>2021-12-12T05:13:35Z</dc:date>
    <item>
      <title>Geocode Table using Esri World Geocode via Python Script</title>
      <link>https://community.esri.com/t5/python-questions/geocode-table-using-esri-world-geocode-via-python/m-p/694438#M53847</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is it possible to geocode a table using the Esri World Geocoder in a stand alone script using Pro and the function&amp;nbsp;&lt;CODE&gt;arcpy.GeocodeAddresses_geocoding&lt;/CODE&gt;?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I'm in Pro and use this tool, and use the Esri World Geocoder we have as an item in our Portal (with an AGO user credentials stored), I can successfully geocode the table as expected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I try writing a stand-alone Python script, it fails every time, and I'm really not sure what I'm doing wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below is a sample of my code:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;# portal variables&lt;/SPAN&gt;
portalUrl &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'...our AGO for Organizations URL...'&lt;/SPAN&gt;
portalUser &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'...userName...'&lt;/SPAN&gt;
portalPassword &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'...userPassword...'&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# geocode variables&lt;/SPAN&gt;
geocodeTable &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'...path to table containing addresses...'&lt;/SPAN&gt;
geocodeUrl &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;'https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer'&lt;/SPAN&gt;
OR
geocodeUrl &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;'...url to our Portal item referencing the Esri World Geocoder with AGO credentials stored...'&lt;/SPAN&gt;
geocodeFieldMap &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Address SiteAddress;City SiteCity;Region SiteState;Postal SiteZip'&lt;/SPAN&gt;
geocodeOutput &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'...path to output feature class...'&lt;/SPAN&gt;

arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SignInToPortal&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;portalUrl&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; portalUser&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; portalPassword&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;GeocodeAddresses_geocoding&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;geocodeTable&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; geocodeUrl&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; geocodeFieldMap&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; geocodeOutput&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; None&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; None&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; None&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; None&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I seem to always get this error:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid.&lt;BR /&gt;ERROR 000005: Could not open the address locator.&lt;BR /&gt;Failed to execute (GeocodeAddresses).&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have also tried using &lt;CODE&gt;arcgis.geocoding.batch_geocode&lt;/CODE&gt; ... but this doesn't preserve any of the other attributes within the table, other than the address information used to locate the point, which is pointless for what we're trying to accomplish.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:13:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/geocode-table-using-esri-world-geocode-via-python/m-p/694438#M53847</guid>
      <dc:creator>mpboyle</dc:creator>
      <dc:date>2021-12-12T05:13:35Z</dc:date>
    </item>
    <item>
      <title>Re: Geocode Table using Esri World Geocode via Python Script</title>
      <link>https://community.esri.com/t5/python-questions/geocode-table-using-esri-world-geocode-via-python/m-p/1037792#M60450</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;The tool you mentioned works only with local adress locators (.loc) not Geocoding REST Endpoint.&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/geocoding/geocode-addresses.htm" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/latest/tool-reference/geocoding/geocode-addresses.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;To use the REST enpoint I suggest to use requests library and make regular http calls.&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Adam&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Mar 2021 19:50:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/geocode-table-using-esri-world-geocode-via-python/m-p/1037792#M60450</guid>
      <dc:creator>nita14</dc:creator>
      <dc:date>2021-03-17T19:50:58Z</dc:date>
    </item>
    <item>
      <title>Re: Geocode Table using Esri World Geocode via Python Script</title>
      <link>https://community.esri.com/t5/python-questions/geocode-table-using-esri-world-geocode-via-python/m-p/1124636#M63221</link>
      <description>&lt;P&gt;It looks like you can use the function with ESRI World Geocoding Service according to example 4 from that page? I'm basically looking to do the same thing as &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/189832"&gt;@mpboyle&lt;/a&gt;.&lt;/P&gt;&lt;P&gt;Out of ignorance, I can't figure out what to use for the locator URL. I have ArcGIS Developer account and I'm able to generate an API key, but I don't know enough to be able to utilize it. This is how it looks in the example, but that URL throws a 403.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;locator = r"https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer/"&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JaredPilbeam2_0-1639088432229.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/29343i1201A59C82AA64E3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JaredPilbeam2_0-1639088432229.png" alt="JaredPilbeam2_0-1639088432229.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Dec 2021 22:20:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/geocode-table-using-esri-world-geocode-via-python/m-p/1124636#M63221</guid>
      <dc:creator>JaredPilbeam2</dc:creator>
      <dc:date>2021-12-09T22:20:40Z</dc:date>
    </item>
  </channel>
</rss>

