I am trying to create a script to:
- Geocode a .CSV file using ArcGIS World Geocoding Service
- Add global IDS
- Append the new feature layer to an existing feature layer
Here is the code I have come up with by going through the various tool reference's
<SPAN class="comment token"># Import module</SPAN>
<SPAN class="keyword token">import</SPAN> arcpy
<SPAN class="keyword token">import</SPAN> sys
<SPAN class="keyword token">import</SPAN> os
<SPAN class="comment token"># Set work environment</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>env<SPAN class="punctuation token">.</SPAN>workspace <SPAN class="operator token">=</SPAN> r<SPAN class="string token">"C:\Users\vmrenfor\EIRP\EIRP_Sewer_Locates\EIRP_Sewer_Locates\Dapps 2019\Dapps 2019.gdb"</SPAN>
<SPAN class="comment token"># Set local variables:</SPAN>
address_table <SPAN class="operator token">=</SPAN> r"C<SPAN class="punctuation token">:</SPAN>\Users\vmrenfor\CSVs\CIVIC\Dapp<SPAN class="comment token">#_16365.csv"</SPAN>
address_locator <SPAN class="operator token">=</SPAN> <SPAN class="string token">"ArcGIS_World_Geocoding_Service.loc"</SPAN>
address_fields <SPAN class="operator token">=</SPAN> <SPAN class="string token">"Address Address;City City;County County;State State;ZIP Postal Code"</SPAN>
geocode_result <SPAN class="operator token">=</SPAN> <SPAN class="string token">"Dapp16365"</SPAN>
<SPAN class="comment token">#Geocode Addresses from csv</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>GeocodeAddresses_geocoding<SPAN class="punctuation token">(</SPAN>address_table<SPAN class="punctuation token">,</SPAN> address_locator<SPAN class="punctuation token">,</SPAN> address_fields<SPAN class="punctuation token">,</SPAN>
geocode_result<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'STATIC'</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token">#Add Global IDs</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>env<SPAN class="punctuation token">.</SPAN>workspace <SPAN class="operator token">=</SPAN> r<SPAN class="string token">"C:\Users\vmrenfor\EIRP\EIRP_Sewer_Locates\EIRP_Sewer_Locates\Dapps 2019\Dapps 2019.gdb"</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>AddGlobalIDs_management<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"Dapp16365"</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token">#Append</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>env<SPAN class="punctuation token">.</SPAN>workspace <SPAN class="operator token">=</SPAN> r<SPAN class="string token">"https://services.arcgis.com/T2graiaSQnlmwwmp/arcgis/rest/services/2019_Taplin/FeatureServer"</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>Append_management<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="string token">"Dapp16365"</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">,</SPAN>
<SPAN class="string token">"Sewer Locate Card"</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>But I get the following error:
Traceback <SPAN class="punctuation token">(</SPAN>most recent call last<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN>
File <SPAN class="string token">"<string>"</SPAN><SPAN class="punctuation token">,</SPAN> line <SPAN class="number token">17</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">in</SPAN> <SPAN class="operator token"><</SPAN>module<SPAN class="operator token">></SPAN>
File <SPAN class="string token">"c:\program files\arcgis\pro\Resources\arcpy\arcpy\geocoding.py"</SPAN><SPAN class="punctuation token">,</SPAN> line <SPAN class="number token">332</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">in</SPAN> GeocodeAddresses
<SPAN class="keyword token">raise</SPAN> e
File <SPAN class="string token">"c:\program files\arcgis\pro\Resources\arcpy\arcpy\geocoding.py"</SPAN><SPAN class="punctuation token">,</SPAN> line <SPAN class="number token">329</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">in</SPAN> GeocodeAddresses
retval <SPAN class="operator token">=</SPAN> convertArcObjectToPythonObject<SPAN class="punctuation token">(</SPAN>gp<SPAN class="punctuation token">.</SPAN>GeocodeAddresses_geocoding<SPAN class="punctuation token">(</SPAN><SPAN class="operator token">*</SPAN>gp_fixargs<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">(</SPAN>in_table<SPAN class="punctuation token">,</SPAN> address_locator<SPAN class="punctuation token">,</SPAN> in_address_fields<SPAN class="punctuation token">,</SPAN> out_feature_class<SPAN class="punctuation token">,</SPAN> out_relationship_type<SPAN class="punctuation token">,</SPAN> country<SPAN class="punctuation token">,</SPAN> location_type<SPAN class="punctuation token">,</SPAN> category<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="token boolean">True</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN>
File <SPAN class="string token">"c:\program files\arcgis\pro\Resources\arcpy\arcpy\geoprocessing\_base.py"</SPAN><SPAN class="punctuation token">,</SPAN> line <SPAN class="number token">496</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">in</SPAN> <SPAN class="operator token"><</SPAN><SPAN class="keyword token">lambda</SPAN><SPAN class="operator token">></SPAN>
<SPAN class="keyword token">return</SPAN> <SPAN class="keyword token">lambda</SPAN> <SPAN class="operator token">*</SPAN>args<SPAN class="punctuation token">:</SPAN> val<SPAN class="punctuation token">(</SPAN><SPAN class="operator token">*</SPAN>gp_fixargs<SPAN class="punctuation token">(</SPAN>args<SPAN class="punctuation token">,</SPAN> <SPAN class="token boolean">True</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN>
arcgisscripting<SPAN class="punctuation token">.</SPAN>ExecuteError<SPAN class="punctuation token">:</SPAN> Failed to execute<SPAN class="punctuation token">.</SPAN> Parameters are <SPAN class="operator token">not</SPAN> valid<SPAN class="punctuation token">.</SPAN>
ERROR <SPAN class="number token">000732</SPAN><SPAN class="punctuation token">:</SPAN> Input Address Locator<SPAN class="punctuation token">:</SPAN> Dataset ArcGIS_World_Geocoding_Service<SPAN class="punctuation token">.</SPAN>loc does <SPAN class="operator token">not</SPAN> exist <SPAN class="operator token">or</SPAN> <SPAN class="keyword token">is</SPAN> <SPAN class="operator token">not</SPAN> supported
ERROR <SPAN class="number token">000005</SPAN><SPAN class="punctuation token">:</SPAN> Could <SPAN class="operator token">not</SPAN> open the address locator<SPAN class="punctuation token">.</SPAN>
Failed to execute <SPAN class="punctuation token">(</SPAN>GeocodeAddresses<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN>
<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>So it appears I am not properly accessing the geocoder to begin with.
Skipping ahead to the Append, I am not sure how to include matching the schema's? The tool reference guide is pretty confusing.
In the Geoprocessing tool window I have:
GlobalID GlobalID
Status USER_Sewer_Status
Address USER_Address
Work_Group USER_Work_Group
City USER_City
Gas_Constr USER_Gas_Construction_Status
.............