<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Creating locator using ArcPy throws ERROR 002815: A table is required for each role. in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/creating-locator-using-arcpy-throws-error-002815-a/m-p/1586483#M93151</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/847604"&gt;@bbauman&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Quick search on that error code I found two related bug which might explain more&lt;/P&gt;&lt;P&gt;&lt;A href="https://support.esri.com/en-us/bug/the-error-message-error-002815-a-table-is-required-for-bug-000170695" target="_blank"&gt;https://support.esri.com/en-us/bug/the-error-message-error-002815-a-table-is-required-for-bug-000170695&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://support.esri.com/en-us/bug/in-arcgis-pro-the-create-locator-geoprocessing-tool-fai-bug-000169803" target="_blank"&gt;https://support.esri.com/en-us/bug/in-arcgis-pro-the-create-locator-geoprocessing-tool-fai-bug-000169803&lt;/A&gt;&lt;/P&gt;&lt;P&gt;FYI&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1499"&gt;@ShanaBritt&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 18 Feb 2025 17:24:19 GMT</pubDate>
    <dc:creator>DanielFox1</dc:creator>
    <dc:date>2025-02-18T17:24:19Z</dc:date>
    <item>
      <title>Creating locator using ArcPy throws ERROR 002815: A table is required for each role.</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/creating-locator-using-arcpy-throws-error-002815-a/m-p/1552009#M89466</link>
      <description>&lt;P&gt;I have been trying to create a locator using ArcPy, but am constantly getting the following error:&lt;BR /&gt;Failed to execute. Parameters are not valid.&lt;BR /&gt;ERROR 002815: A table is required for each role.&lt;BR /&gt;Failed to execute (CreateLocator)&lt;/P&gt;&lt;P&gt;The code I'm using is copied directly from the&lt;SPAN&gt;&amp;nbsp;geoprocessing history tab in the Catalog pane after creating the locator manually via ArcGIS Pro, via right-clicking on the tool result and selecting&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/analysis/geoprocessing/basics/run-geoprocessing-tools.htm#ESRI_SECTION1_14C98A99F1BA47FB976F252C8FC0BE50" target="_self" rel="nofollow noopener noreferrer"&gt;copy as Python command&lt;/A&gt;&lt;SPAN&gt;.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;For demonstration purposes, I've hardcoded the layers for ease of readability (and to help troubleshoot). Code is as follows:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;
import arcpy
import os

project_dir = r"path\to\GeocodingProject"
project_name = "GeocodingProject"

aprx = arcpy.mp.ArcGISProject(os.path.join(project_dir, f"{project_name}.aprx"))

map = aprx.listMaps()[0]

try:
    # Create Locator
    country_code = 'USA'
    language_code = "ENG"
    precision_type = "GLOBAL_HIGH"
    out_locator = os.path.join(project_dir, f"geocoding_locator_state_11")
    primary_reference_data = "tl_2024_11_addrfeat_featnames StreetAddress"

    field_mapping = [
            f"StreetAddress.FEATURE_ID 'tl_2024_11_addrfeat_featnames.shp'.FID",\
            f"StreetAddress.HOUSE_NUMBER_FROM_LEFT 'tl_2024_11_addrfeat_featnames.shp'.LFROMHN",\
            f"StreetAddress.HOUSE_NUMBER_TO_LEFT 'tl_2024_11_addrfeat_featnames.shp'.LTOHN",\
            f"StreetAddress.HOUSE_NUMBER_FROM_RIGHT 'tl_2024_11_addrfeat_featnames.shp'.RFROMHN",\
            f"StreetAddress.HOUSE_NUMBER_TO_RIGHT 'tl_2024_11_addrfeat_featnames.shp'.RTOHN",\
            f"StreetAddress.PARITY_LEFT 'tl_2024_11_addrfeat_featnames.shp'.PARITYL",\
            f"StreetAddress.PARITY_RIGHT 'tl_2024_11_addrfeat_featnames.shp'.PARITYR",\
            f"StreetAddress.STREET_PREFIX_DIR 'tl_2024_11_addrfeat_featnames.shp'.PREDIR",\
            f"StreetAddress.STREET_PREFIX_TYPE 'tl_2024_11_addrfeat_featnames.shp'.PRETYP",\
            f"StreetAddress.STREET_NAME 'tl_2024_11_addrfeat_featnames.shp'.NAME",\
            f"StreetAddress.STREET_SUFFIX_TYPE 'tl_2024_11_addrfeat_featnames.shp'.SUFTYP",\
            f"StreetAddress.STREET_SUFFIX_DIR 'tl_2024_11_addrfeat_featnames.shp'.SUFDIR",\
            f"StreetAddress.FULL_STREET_NAME 'tl_2024_11_addrfeat_featnames.shp'.FULLNAME",\
            f"StreetAddress.POSTAL_LEFT 'tl_2024_11_addrfeat_featnames.shp'.ZIPL",\
            f"StreetAddress.POSTAL_RIGHT 'tl_2024_11_addrfeat_featnames.shp'.ZIPR",\
            f"StreetAddress.POSTAL_EXT_LEFT 'tl_2024_11_addrfeat_featnames.shp'.PLUS4L",\
            f"StreetAddress.POSTAL_EXT_RIGHT 'tl_2024_11_addrfeat_featnames.shp'.PLUS4R"
            ]
   
    arcpy.geocoding.CreateLocator(
        country_code=country_code,
        primary_reference_data=primary_reference_data,
        field_mapping=field_mapping,
        out_locator=out_locator,
        language_code=language_code,
        alternatename_tables=None,
        alternate_field_mapping=None,
        custom_output_fields=None,
        precision_type="GLOBAL_HIGH"
    )
    print("Locator created successfully.")

    aprx.save()
except Exception as e:
    print(f"Error creating locator: {e}")



&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 24 Oct 2024 18:36:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/creating-locator-using-arcpy-throws-error-002815-a/m-p/1552009#M89466</guid>
      <dc:creator>bbauman</dc:creator>
      <dc:date>2024-10-24T18:36:35Z</dc:date>
    </item>
    <item>
      <title>Re: Creating locator using ArcPy throws ERROR 002815: A table is required for each role.</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/creating-locator-using-arcpy-throws-error-002815-a/m-p/1586479#M93149</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/847604"&gt;@bbauman&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. Is the shapefile referenced as the primary_reference_data variable in the path listed below?&lt;/P&gt;&lt;P&gt;"project_dir = r"path\to\GeocodingProject"&lt;/P&gt;&lt;P&gt;2. If the shapefile is in that path, you should use "&lt;SPAN&gt;arcpy.env.workspace " set to the path to the&amp;nbsp; shapefile. This is needed when running the script as a standalone script outside of ArcGIS Pro. There is a standalone script example in the tool help that you can use as a reference (Python tab),&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/geocoding/create-locator.htm#GUID-61AE3A4C-211F-4BAF-83DD-1850A7A6911D" target="_blank" rel="noopener"&gt;https://pro.arcgis.com/en/pro-app/latest/tool-reference/geocoding/create-locator.htm#GUID-61AE3A4C-211F-4BAF-83DD-1850A7A6911D&lt;/A&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;3. You can also try putting the full&amp;nbsp; path and file extension to the shapefile in the&amp;nbsp;&lt;SPAN&gt;primary_reference_data variable.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;4. If you open the project and copy the Python from the History and paste it into the Python window in ArcGIS Pro to run the script does the error occur?&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;5.&lt;/STRONG&gt; When building the locator it is important not to map the Feature_ID field when you do not have duplicate features with different attributes in the primary data. It looks like you are using TIGER line data in the example you&amp;nbsp; provided and mapping FID to Feature_ID for this data is not necessary and can impact the performance and quality of the locator and results.&lt;/P&gt;&lt;P&gt;Here are some helpful resources:&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/data/geocoding/create-a-locator-that-restores-missing-zones.htm" target="_blank" rel="noopener"&gt;https://pro.arcgis.com/en/pro-app/latest/help/data/geocoding/create-a-locator-that-restores-missing-zones.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/data/geocoding/collapse-duplicate-features-in-the-data.htm" target="_blank" rel="noopener"&gt;https://pro.arcgis.com/en/pro-app/latest/help/data/geocoding/collapse-duplicate-features-in-the-data.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Feb 2025 17:18:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/creating-locator-using-arcpy-throws-error-002815-a/m-p/1586479#M93149</guid>
      <dc:creator>ShanaBritt</dc:creator>
      <dc:date>2025-02-18T17:18:10Z</dc:date>
    </item>
    <item>
      <title>Re: Creating locator using ArcPy throws ERROR 002815: A table is required for each role.</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/creating-locator-using-arcpy-throws-error-002815-a/m-p/1586483#M93151</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/847604"&gt;@bbauman&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Quick search on that error code I found two related bug which might explain more&lt;/P&gt;&lt;P&gt;&lt;A href="https://support.esri.com/en-us/bug/the-error-message-error-002815-a-table-is-required-for-bug-000170695" target="_blank"&gt;https://support.esri.com/en-us/bug/the-error-message-error-002815-a-table-is-required-for-bug-000170695&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://support.esri.com/en-us/bug/in-arcgis-pro-the-create-locator-geoprocessing-tool-fai-bug-000169803" target="_blank"&gt;https://support.esri.com/en-us/bug/in-arcgis-pro-the-create-locator-geoprocessing-tool-fai-bug-000169803&lt;/A&gt;&lt;/P&gt;&lt;P&gt;FYI&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1499"&gt;@ShanaBritt&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Feb 2025 17:24:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/creating-locator-using-arcpy-throws-error-002815-a/m-p/1586483#M93151</guid>
      <dc:creator>DanielFox1</dc:creator>
      <dc:date>2025-02-18T17:24:19Z</dc:date>
    </item>
  </channel>
</rss>

