Select to view content in your preferred language

Geocoding in Pro Jupyter notebook with Street Map Premium

128
2
Jump to solution
Tuesday
ZenMasterZeke
Frequent Contributor

I'm trying to geocode a csv file in an ArcGIS Pro Jupyter notebook, using our Street Map Premium locator. No matter what I do, it returns 'RunTimeError: Object: Error in executing tool'. I'm following the ESRI documentation here. I have an SMP license.

I don't really understand the sample field map at "\'Address or Place\' Address" or "ZIP ZIP <None>", since that doesn't follow the pattern of the rest of the fields. I've also tried adding the field names from the csv - address1, address2, city, state, zip - in the <None> spots, but it doesn't appear to make a difference.

Any ideas on what's going wrong? Thanks.

# Geocode csv
cwd = Path(os.getcwd())
csv_path = cwd / r"Data\Recruitment_2026-06-23.csv"
smp_locator = r'<path to locator>\My_2026_Q1.loc'
output_fc = cwd / r'Recruitment'

field_map = ("\'Address or Place\' Address VISIBLE NONE;Address2 <None> VISIBLE NONE;Address3 <None> VISIBLE NONE;" +
             "Neighborhood <None> VISIBLE NONE;City <None> VISIBLE NONE;Subregion <None> VISIBLE NONE;" +
             "Region <None> VISIBLE NONE;ZIP ZIP <None> VISIBLE NONE;ZIP4 <None> VISIBLE NONE;" +
             "Country <None> VISIBLE NONE")
try:
    # Error occurs here
    arcpy.geocoding.GeocodeAddresses(csv_path, smp_locator, field_map, output_fc)
except RuntimeError as e: 
    import traceback
    print(f"Exception message: {str(e)}")
    error_stack = traceback.format_exc()
    print(error_stack)
else: 
    print(f"Geocoding complete: {output_fc}")
0 Kudos
1 Solution

Accepted Solutions
TonyAlmeida
MVP Regular Contributor

The issue might be the extra "<None>" in your field mapping. for example, Address2 <None> VISIBLE NONE, ZIP ZIP <None> VISIBLE NONE, I think it should be ZIP ZIP VISIBLE NONE, etc.

View solution in original post

2 Replies
TonyAlmeida
MVP Regular Contributor

The issue might be the extra "<None>" in your field mapping. for example, Address2 <None> VISIBLE NONE, ZIP ZIP <None> VISIBLE NONE, I think it should be ZIP ZIP VISIBLE NONE, etc.

ZenMasterZeke
Frequent Contributor

Thanks @TonyAlmeida, working now. I'd wondered about that and had tried deleting it before, but something else must've been wrong then. ESRI has it in the documentation this way for at least two Pro releases I saw, 3.5 & 3.5. 🐍

0 Kudos