ArcGIS Pro 2.7.2
Just started using the Create Composite Locator tool and now I am scripting it in python to automate the process. My python works, but I don't understand the field mapping portion of the tool and subsequently what I am providing to my script.
Here is a snapshot of the tool and parameters:
I purposely whittled down all the various input fields that appear by default, since I don't understand what they provide the tool.
When creating python scripts for geocoding, I always use the tool history details as a means to provide me the parameters of a successful tool run:
The resulting function in my script creates the composite locator just fine:
def compositeLocator():
addressLocators = r"N:\GIS\Geocoding\NewGeocoding\MsdMultiRoleLocator.loc MsdLocator;"\
r"N:\GIS\Geocoding\NewGeocoding\NonMSDMultiRoleLocator.loc NonMsdLocator"
fieldMap = r'Address "Address or Place" true true false 100 Text 0 0,First,#,N:\GIS\Geocoding\NewGeocoding\MsdMultiRoleLocator.loc,Address,0,0,N:\GIS\Geocoding\NewGeocoding\NonMSDMultiRoleLocator.loc,Address,0,0'
selectionCriteria = "MsdLocator #;"\
"NonMsdLocator #"
outLocator = r'N:\GIS\Geocoding\NewGeocoding\CityWorksLocator'
arcpy.geocoding.CreateCompositeAddressLocator(addressLocators, fieldMap, selectionCriteria, outLocator)
My question is this: in the fieldMap variable what are the various arguments such as:
Address "Address or Place" true true false 100 Text 0 0,First,#,(etc,etc, etc..)
Is there any documentation on this? I haven't stumbled upon any as of yet.
Solved! Go to Solution.
Joe:
The Field Mappings control is used in a few tools such as Merge (Data Management) and Create Composite Address Locator (Geocoding) tools. Unfortunately, we do not have this info documented specifically for the Create Composite Address Locator tool, but it is something we can add to the documentation for a future release. Here is documentation about mapping fields in Python, https://pro.arcgis.com/en/pro-app/latest/arcpy/get-started/mapping-fields.htm.
The Python strings for Field Mappings are similar between these 2 tools.
For Create Composite Address Locator, here are the parameters, plus the example you provided:
Field1 | New field name | Address |
'Field1' | Alias of new field | "Address or Place" |
true | IsEditable | true |
true | Allow NULL values | true |
false | Required | false |
4 | Length | 100 |
Long | Type | Text |
0 | Scale | 0 |
0 | Precision | 0 |
First | Merge Rule | First |
# | Delimiter | # |
For Merge, here are the parameters:
ObjectID | New field name |
'ObjectID' | Alias of new field |
true | IsEditable |
true | Allow NULL values |
false | Required |
4 | Length |
Long | Type |
0 | Scale |
0 | Precision |
First | Merge Rule |
# | Delimiter |
C:\\temp\\test1.gdb\\Hospital | Source data |
OBJECTID | Source field |
-1 | Start Position |
-1 | End Position |
I hope this helps.
-Shana
Joe:
The Field Mappings control is used in a few tools such as Merge (Data Management) and Create Composite Address Locator (Geocoding) tools. Unfortunately, we do not have this info documented specifically for the Create Composite Address Locator tool, but it is something we can add to the documentation for a future release. Here is documentation about mapping fields in Python, https://pro.arcgis.com/en/pro-app/latest/arcpy/get-started/mapping-fields.htm.
The Python strings for Field Mappings are similar between these 2 tools.
For Create Composite Address Locator, here are the parameters, plus the example you provided:
Field1 | New field name | Address |
'Field1' | Alias of new field | "Address or Place" |
true | IsEditable | true |
true | Allow NULL values | true |
false | Required | false |
4 | Length | 100 |
Long | Type | Text |
0 | Scale | 0 |
0 | Precision | 0 |
First | Merge Rule | First |
# | Delimiter | # |
For Merge, here are the parameters:
ObjectID | New field name |
'ObjectID' | Alias of new field |
true | IsEditable |
true | Allow NULL values |
false | Required |
4 | Length |
Long | Type |
0 | Scale |
0 | Precision |
First | Merge Rule |
# | Delimiter |
C:\\temp\\test1.gdb\\Hospital | Source data |
OBJECTID | Source field |
-1 | Start Position |
-1 | End Position |
I hope this helps.
-Shana
Thanks Shana!