arcpy.CreateAddressLocator_geocoding raise ERROR 000046 too many reference data tables for this style

599
1
Jump to solution
09-19-2019 07:03 AM
MaximeDemers
Occasional Contributor III

Hi,

I have an error while trying to automatize the creation of an address locator. Any idea what can be wrong in my code below?

I only use 1 data table as reference so why this error?

I am using arcpy v10.6

import arcpy

arcpy.env.workspace = "C:\\Script\\Connexions\\connection.sde\\MyDataSet"

configs = {
    "IN_ADDRESS_LOCATOR_STYLE": "General-Single Field",
    "IN_REFERENCE_DATA": "ReferenceDataFC 'Primary Table'",
    "IN_FIELD_MAP": "'Feature ID' ObjectID VISIBLE NONE;'*KeyField' addresse VISIBLE NONE",
    "OUT_ADDRESS_LOCATOR": "C:\\Script\\Output\\MyLocator",
    "CONFIG_KEYWORD": None
    "ENABLE_SUGGESTIONS": "ENABLED"
}

arcpy.CreateAddressLocator_geocoding(
    in_address_locator_style = configs["IN_ADDRESS_LOCATOR_STYLE"],
    in_reference_data = configs["IN_REFERENCE_DATA"],
    in_field_map = configs["IN_FIELD_MAP"],
    out_address_locator = configs["LOC"],
    config_keyword = configs["CONFIG_KEYWORD"],
    enable_suggestions = configs["ENABLE_SUGGESTIONS"]
)‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

I have noticed that if I write "General - Single Field" instead of "General-Single Field" for the in_address_locator_style parameter I got the ERROR 000039: Not enough reference data tables for this style.

This is very confusing...

0 Kudos
1 Solution

Accepted Solutions
MaximeDemers
Occasional Contributor III

After many test, I have found that in_address_locator_style parameter should be written "General - Single Field" and the in_reference_data parameter should only have the featureClass full path (or name if the arcpy.env.workspace is defined correctly like below)

import arcpy

arcpy.env.workspace = "C:\\Script\\Connexions\\connection.sde\\MyDataSet"

configs = {
    "IN_ADDRESS_LOCATOR_STYLE": "General - Single Field",
    "IN_REFERENCE_DATA": "ReferenceDataFC",
    "IN_FIELD_MAP": "'Feature ID' ObjectID VISIBLE NONE;'*KeyField' addresse VISIBLE NONE",
    "OUT_ADDRESS_LOCATOR": "C:\\Script\\Output\\MyLocator",
    "CONFIG_KEYWORD": None
    "ENABLE_SUGGESTIONS": "ENABLED"
}

arcpy.CreateAddressLocator_geocoding(
    in_address_locator_style = configs["IN_ADDRESS_LOCATOR_STYLE"],
    in_reference_data = configs["IN_REFERENCE_DATA"],
    in_field_map = configs["IN_FIELD_MAP"],
    out_address_locator = configs["LOC"],
    config_keyword = configs["CONFIG_KEYWORD"],
    enable_suggestions = configs["ENABLE_SUGGESTIONS"]
)

View solution in original post

0 Kudos
1 Reply
MaximeDemers
Occasional Contributor III

After many test, I have found that in_address_locator_style parameter should be written "General - Single Field" and the in_reference_data parameter should only have the featureClass full path (or name if the arcpy.env.workspace is defined correctly like below)

import arcpy

arcpy.env.workspace = "C:\\Script\\Connexions\\connection.sde\\MyDataSet"

configs = {
    "IN_ADDRESS_LOCATOR_STYLE": "General - Single Field",
    "IN_REFERENCE_DATA": "ReferenceDataFC",
    "IN_FIELD_MAP": "'Feature ID' ObjectID VISIBLE NONE;'*KeyField' addresse VISIBLE NONE",
    "OUT_ADDRESS_LOCATOR": "C:\\Script\\Output\\MyLocator",
    "CONFIG_KEYWORD": None
    "ENABLE_SUGGESTIONS": "ENABLED"
}

arcpy.CreateAddressLocator_geocoding(
    in_address_locator_style = configs["IN_ADDRESS_LOCATOR_STYLE"],
    in_reference_data = configs["IN_REFERENCE_DATA"],
    in_field_map = configs["IN_FIELD_MAP"],
    out_address_locator = configs["LOC"],
    config_keyword = configs["CONFIG_KEYWORD"],
    enable_suggestions = configs["ENABLE_SUGGESTIONS"]
)

0 Kudos