hello
i have 80 tables and i want to geocode them all at once by using model builder and iterator but i think that i'am doing something wrong because i get only the first table as output.i have set all the tables in a workspace then i linked them as input tables to a table iterator then i linked them an adress locator (esri adress locator).
Have you considered exporting the model to python and use python code to iterate through the tables?
hi and thanks for you answer.no i didn't do it since i don't know how to do that.i will try that
Are you working with ArcMap or Pro?
i'am working with pro
Here my model and the python script i got but seems that there's a mistake somewhere.
# -*- coding: utf-8 -*-
"""Generated by ArcGIS ModelBuilder on: 2020-03-14 17:25:41
All ModelBuilder functionality may not be exported. Edits may be required for equivalency with the original model.
"""
import arcpy
# To allow overwriting the outputs change the overwrite option to true.
arcpy.env.overwriteOutput = True
# Load required toolboxes
arcpy.ImportToolbox("Model Tools")
# Script parameters
YMZ_gdb = arcpy.GetParameterAsText(0) or r"C:\Users\abøminàtion\Desktop\YMZ.gdb"
# Local variables:
Repartition_clt_201945_ExcelToTable = "Repartition_clt_201945_ExcelToTable"
YMZ_gdb__2_ = YMZ_gdb
Nom = "Repartition_clt_201945_ExcelToTable"
Table = r"C:\Users\abøminàtion\Desktop\YMZ.gdb\Repartition_clt_201945_ExcelToTable"
Esri_World_Geocoder = "https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/Esri World Geocoder"
Repartition_clt_201945_Excel = r"C:\Users\abøminàtion\Desktop\YMZ.gdb\Repartition_clt_201945_Excel"
# Process: Fractionner selon les attributs
arcpy.SplitByAttributes_analysis(Input_Table=Repartition_clt_201945_ExcelToTable, Target_Workspace=YMZ_gdb, Split_Fields="Magasin_visité")
# Process: Itérer dans des tables
arcpy.IterateTables_mb(in_workspace=YMZ_gdb__2_, wildcard="", table_type="", recursive="NOT_RECURSIVE")
# Process: Géocoder des adresses
arcpy.GeocodeAddresses_geocoding(in_table=Table, address_locator=Esri_World_Geocoder, in_address_fields="'Adresse ou lieu' <Aucun> VISIBLE NONE;Adresse2 <Aucun> VISIBLE NONE;Adresse3 <Aucun> VISIBLE NONE;Neighborhood <Aucun> VISIBLE NONE;Ville Ville VISIBLE NONE;County <Aucun> VISIBLE NONE;State <Aucun> VISIBLE NONE;'Code Postal' <Aucun> VISIBLE NONE;ZIP4 <Aucun> VISIBLE NONE;'Code du pays' <Aucun> VISIBLE NONE", out_feature_class=Repartition_clt_201945_Excel, out_relationship_type="STATIC", country="TN", location_type="ROUTING_LOCATION", category="Subaddress;'Point Address';'Street Address';'Distance Marker';Intersection;'Street Name';'Primary Postal';'Postal Locality';'Postal Extension';Block;Sector;Neighborhood;District;City;'Metro Area';Subregion;Region;Territory;Country;Zone")
Traceback (most recent call last):
File "<string>", line 12, in <module>
File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\__init__.py", line 159, in ImportToolbox
return import_toolbox(input_file, module_name)
File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\toolbox_code.py", line 466, in import_toolbox
toolbox = gp.createObject("Toolbox", tbxfile)
File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\geoprocessing\_base.py", line 383, in createObject
self._gp.CreateObject(*gp_fixargs(args, True)))
OSError: Le fichier Model Tools de la boîte à outils est introuvable.
# -*- coding: utf-8 -*-
"""Generated by ArcGIS ModelBuilder on: 2020-03-14 17:28:12
All ModelBuilder functionality may not be exported. Edits may be required for equivalency with the original model.
"""
import arcpy
# To allow overwriting the outputs change the overwrite option to true.
arcpy.env.overwriteOutput = True
# Load required toolboxes
arcpy.ImportToolbox("hggd")
# Script parameters
YMZ_gdb = arcpy.GetParameterAsText(0) or r"C:\Users\abøminàtion\Desktop\YMZ.gdb"
# Local variables:
Repartition_clt_201945_ExcelToTable = "Repartition_clt_201945_ExcelToTable"
YMZ_gdb__2_ = YMZ_gdb
Nom = "Repartition_clt_201945_ExcelToTable"
Table = r"C:\Users\abøminàtion\Desktop\YMZ.gdb\Repartition_clt_201945_ExcelToTable"
Esri_World_Geocoder = "https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/Esri World Geocoder"
Repartition_clt_201945_Excel = r"C:\Users\abøminàtion\Desktop\YMZ.gdb\Repartition_clt_201945_Excel"
# Process: Fractionner selon les attributs
arcpy.SplitByAttributes_analysis(Input_Table=Repartition_clt_201945_ExcelToTable, Target_Workspace=YMZ_gdb, Split_Fields="Magasin_visité")
# Process: Itérer dans des tables
arcpy.IterateTables_mb(in_workspace=YMZ_gdb__2_, wildcard="", table_type="", recursive="NOT_RECURSIVE")
# Process: Géocoder des adresses
arcpy.GeocodeAddresses_geocoding(in_table=Table, address_locator=Esri_World_Geocoder, in_address_fields="'Adresse ou lieu' <Aucun> VISIBLE NONE;Adresse2 <Aucun> VISIBLE NONE;Adresse3 <Aucun> VISIBLE NONE;Neighborhood <Aucun> VISIBLE NONE;Ville Ville VISIBLE NONE;County <Aucun> VISIBLE NONE;State <Aucun> VISIBLE NONE;'Code Postal' <Aucun> VISIBLE NONE;ZIP4 <Aucun> VISIBLE NONE;'Code du pays' <Aucun> VISIBLE NONE", out_feature_class=Repartition_clt_201945_Excel, out_relationship_type="STATIC", country="TN", location_type="ROUTING_LOCATION", category="Subaddress;'Point Address';'Street Address';'Distance Marker';Intersection;'Street Name';'Primary Postal';'Postal Locality';'Postal Extension';Block;Sector;Neighborhood;District;City;'Metro Area';Subregion;Region;Territory;Country;Zone")
Traceback (most recent call last):
File "<string>", line 25, in <module>
File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\analysis.py", line 258, in SplitByAttributes
raise e
File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\analysis.py", line 255, in SplitByAttributes
retval = convertArcObjectToPythonObject(gp.SplitByAttributes_analysis(*gp_fixargs((Input_Table, Target_Workspace, Split_Fields), True)))
File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\geoprocessing\_base.py", line 506, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))
arcgisscripting.ExecuteError: ERROR 000210: Impossible de créer la sortie C:\Users\abøminàtion\Downloads\Repartition_clt_2019 45.xlsx\MG_CITY_AIN_ZAGHOUAN
Échec de l’exécution de (TableSelect).
Échec de l’exécution de (SplitByAttributes).