I am trying to create a composite locator in python, but it doesn't seem to work. All the points are left unmatched. The locators behind it work fine and I don't receive any errors. Is there something wrong in my code?
milepoints_prod = PROD_FOLDER+"\\"+milepoints_locator
census_prod = PROD_FOLDER+"\\" + census_locator
pa_prod = PROD_FOLDER+"\\" + pa_singlehouse
sa_prod = PROD_FOLDER+"\\" + sa_singlehouse
er_prod = PROD_FOLDER+"\\" + er_singlehouse
if os.path.exists(PROD_FOLDER+"\\"+pa_composite):
os.remove(PROD_FOLDER+"\\"+pa_composite)
address = "Address 'Address or Place' true true false 100 Text 0 0,First,#,pa_prod,Address,0,0,milepoints_prod,Address,0,0,census_prod,Address,0,0;"
address_2 = "Address2 'Address2' true true false 100 Text 0 0,First,#,pa_prod,Address2,0,0,milepoints_prod,Address2,0,0,census_prod,Address2,0,0;"
address_3 = "Address3 'Address3' true true false 100 Text 0 0,First,#,pa_prod,Address3,0,0,milepoints_prod,Address3,0,0,census_prod,Address3,0,0;"
neighborhood = "Neighborhood 'Neighborhood' true true false 50 Text 0 0,First,#,pa_prod,Neighborhood,0,0,milepoints_prod,Neighborhood,0,0,census_prod,Neighborhood,0,0;"
city = "City 'City' true true false 50 Text 0 0,First,#,pa_prod,City,0,0,milepoints_prod,City,0,0,census_prod,City,0,0;"
county = "Subregion 'County' true true false 50 Text 0 0,First,#,pa_prod,Subregion,0,0,milepoints_prod,Subregion,0,0,census_prod,Subregion,0,0;"
STATE = "Region 'State' true true false 50 Text 0 0,First,#,pa_prod,Region,0,0,milepoints_prod,Region,0,0,census_prod,Region,0,0;"
ZIPC = "Postal 'ZIP' true true false 20 Text 0 0,First,#,pa_prod,Postal,0,0,milepoints_prod,Postal,0,0,census_prod,Postal,0,0;"
ZIP4 = "PostalExt 'ZIP4' true true false 20 Text 0 0,First,#,pa_prod,PostalExt,0,0,milepoints_prod,PostalExt,0,0,census_prod,PostalExt,0,0;"
country = "CountryCode 'Country' true true false 100 Text 0 0,First,#,pa_prod,CountryCode,0,0,milepoints_prod,CountryCode,0,0,census_prod,CountryCode,0,0"
composite_locator_field_map = address + address_2 + address_3 + neighborhood + city + county + STATE + ZIPC + ZIP4 + country
arcpy.geocoding.CreateCompositeAddressLocator(pa_prod+" PA_Singlehouse;"+milepoints_prod+" CDOT_Mile_Poin;"+census_prod+" Census_Roads", composite_locator_field_map, "PA_Singlehouse #;CDOT_Mile_Poin #;Census_Roads #", PROD_FOLDER+"\\"+pa_composite)
Solved! Go to Solution.
One thing to check is if Match without Zone is set to True as it is False by default.
One thing to check is if Match without Zone is set to True as it is False by default.