<?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 ERROR 999999 With arcpy.geocoding.CreateFeatureLocator() in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/error-999999-with-arcpy-geocoding/m-p/1525875#M71300</link>
    <description>&lt;P&gt;I am trying to automate the process of updating feature locators for our ArcGIS Pro desktop apps. The goal is to take the layer from ArcGIS Online and make the locators, then put them in a folder on a local network drive. I have this code, but `GasCurbValveLocator` always errors with error 999999, failed to execute and no other description.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import os
import zipfile
from arcgis.gis import GIS

import arcpy



if __name__ == '__main__':
    print('Start')
    locators = [
        {
            "name": "AddressLocator",
            "link": 'https://services5.arcgis.com/g3r4E4Xlpygk5wEz/arcgis/rest/services/Addresses/FeatureServer/0',
            "map": """
                "'*Name' FullStName VISIBLE NONE" 
            """,
            "etc": """
                "'UnitNumber' UnitNum;
                'StreetAddress' Address;
                'CityName' City;
                'PostalCode' Zip;
                'LocationName' PlaceName;
                'PINNumber' PIN;
                'Subdiv' Subdivision;
                'AddressNumber' AddrNum"
            """
        },
        {
            "name": "BuildingNameLocator",
            "link": 'https://services5.arcgis.com/g3r4E4Xlpygk5wEz/arcgis/rest/services/Buildings_Footprints/FeatureServer/8',
            "map": "'*Name' BldgName VISIBLE NONE"
        },
        {
            "name": "GasCurbValveLocator",
            "link": 'https://services5.arcgis.com/g3r4E4Xlpygk5wEz/arcgis/rest/services/Gas_Curb_Valve_GPS/FeatureServer/0',
            "map": "'*Name' ValveID VISIBLE NONE"
        },
        {
            "name": "GasMainValveLocator",
            "link": 'https://services5.arcgis.com/g3r4E4Xlpygk5wEz/arcgis/rest/services/GasValveLive/FeatureServer/0',
            "map": "'*Name' ValveID VISIBLE NONE"
        },
        {
            "name": "HydrantLocator",
            "link": 'https://services5.arcgis.com/g3r4E4Xlpygk5wEz/arcgis/rest/services/Hydrants/FeatureServer/3',
            "map": "*Name FACILITYID VISIBLE NONE"
        },
        {
            "name": "RoadIntersectionLocator",
            "link": 'https://services5.arcgis.com/g3r4E4Xlpygk5wEz/arcgis/rest/services/Roads/FeatureServer/31',
            "map": "*Name Alphatag VISIBLE NONE"
        },
        {
            "name": "WaterLateralValveLocator",
            "link": 'https://services5.arcgis.com/g3r4E4Xlpygk5wEz/arcgis/rest/services/Water_All_Valves/FeatureServer/2',
            "map": "*Name FACILITYID VISIBLE NONE"
        },
        {
            "name": "WaterMainValveLocator",
            "link": 'https://services5.arcgis.com/g3r4E4Xlpygk5wEz/arcgis/rest/services/Water_All_Valves/FeatureServer/2',
            "map": "*Name FACILITYID VISIBLE NONE"
        },
        {
            "name": "WaterTowerLocator",
            "link": 'https://services5.arcgis.com/g3r4E4Xlpygk5wEz/arcgis/rest/services/Water_Tower/FeatureServer/0',
            "map": "*Name FacilityID VISIBLE NONE"
        } 
    ]
    gis = GIS(profile='python_arcgis_credentials')
    arcpy.SignInToPortal("https://www.cfu.maps.arcgis.com")
    for locator in [locators[2]]:
        try:
            print(locator['name'])
            arcpy.geocoding.CreateFeatureLocator(
            in_features=locator['link'],
            output_locator=os.path.join(r"G:\Water_and_Gas_Operations\ArcGIS\Feature Locator Files", locator['name']),
            search_fields=locator['map'],            # Unique identifier field
            locator_fields=locator.get('etc')
        )
        except Exception as e:
            print(e)
    print('End')&lt;/LI-CODE&gt;</description>
    <pubDate>Thu, 22 Aug 2024 15:57:02 GMT</pubDate>
    <dc:creator>MichaelAscher</dc:creator>
    <dc:date>2024-08-22T15:57:02Z</dc:date>
    <item>
      <title>ERROR 999999 With arcpy.geocoding.CreateFeatureLocator()</title>
      <link>https://community.esri.com/t5/python-questions/error-999999-with-arcpy-geocoding/m-p/1525875#M71300</link>
      <description>&lt;P&gt;I am trying to automate the process of updating feature locators for our ArcGIS Pro desktop apps. The goal is to take the layer from ArcGIS Online and make the locators, then put them in a folder on a local network drive. I have this code, but `GasCurbValveLocator` always errors with error 999999, failed to execute and no other description.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import os
import zipfile
from arcgis.gis import GIS

import arcpy



if __name__ == '__main__':
    print('Start')
    locators = [
        {
            "name": "AddressLocator",
            "link": 'https://services5.arcgis.com/g3r4E4Xlpygk5wEz/arcgis/rest/services/Addresses/FeatureServer/0',
            "map": """
                "'*Name' FullStName VISIBLE NONE" 
            """,
            "etc": """
                "'UnitNumber' UnitNum;
                'StreetAddress' Address;
                'CityName' City;
                'PostalCode' Zip;
                'LocationName' PlaceName;
                'PINNumber' PIN;
                'Subdiv' Subdivision;
                'AddressNumber' AddrNum"
            """
        },
        {
            "name": "BuildingNameLocator",
            "link": 'https://services5.arcgis.com/g3r4E4Xlpygk5wEz/arcgis/rest/services/Buildings_Footprints/FeatureServer/8',
            "map": "'*Name' BldgName VISIBLE NONE"
        },
        {
            "name": "GasCurbValveLocator",
            "link": 'https://services5.arcgis.com/g3r4E4Xlpygk5wEz/arcgis/rest/services/Gas_Curb_Valve_GPS/FeatureServer/0',
            "map": "'*Name' ValveID VISIBLE NONE"
        },
        {
            "name": "GasMainValveLocator",
            "link": 'https://services5.arcgis.com/g3r4E4Xlpygk5wEz/arcgis/rest/services/GasValveLive/FeatureServer/0',
            "map": "'*Name' ValveID VISIBLE NONE"
        },
        {
            "name": "HydrantLocator",
            "link": 'https://services5.arcgis.com/g3r4E4Xlpygk5wEz/arcgis/rest/services/Hydrants/FeatureServer/3',
            "map": "*Name FACILITYID VISIBLE NONE"
        },
        {
            "name": "RoadIntersectionLocator",
            "link": 'https://services5.arcgis.com/g3r4E4Xlpygk5wEz/arcgis/rest/services/Roads/FeatureServer/31',
            "map": "*Name Alphatag VISIBLE NONE"
        },
        {
            "name": "WaterLateralValveLocator",
            "link": 'https://services5.arcgis.com/g3r4E4Xlpygk5wEz/arcgis/rest/services/Water_All_Valves/FeatureServer/2',
            "map": "*Name FACILITYID VISIBLE NONE"
        },
        {
            "name": "WaterMainValveLocator",
            "link": 'https://services5.arcgis.com/g3r4E4Xlpygk5wEz/arcgis/rest/services/Water_All_Valves/FeatureServer/2',
            "map": "*Name FACILITYID VISIBLE NONE"
        },
        {
            "name": "WaterTowerLocator",
            "link": 'https://services5.arcgis.com/g3r4E4Xlpygk5wEz/arcgis/rest/services/Water_Tower/FeatureServer/0',
            "map": "*Name FacilityID VISIBLE NONE"
        } 
    ]
    gis = GIS(profile='python_arcgis_credentials')
    arcpy.SignInToPortal("https://www.cfu.maps.arcgis.com")
    for locator in [locators[2]]:
        try:
            print(locator['name'])
            arcpy.geocoding.CreateFeatureLocator(
            in_features=locator['link'],
            output_locator=os.path.join(r"G:\Water_and_Gas_Operations\ArcGIS\Feature Locator Files", locator['name']),
            search_fields=locator['map'],            # Unique identifier field
            locator_fields=locator.get('etc')
        )
        except Exception as e:
            print(e)
    print('End')&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 22 Aug 2024 15:57:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-999999-with-arcpy-geocoding/m-p/1525875#M71300</guid>
      <dc:creator>MichaelAscher</dc:creator>
      <dc:date>2024-08-22T15:57:02Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 999999 With arcpy.geocoding.CreateFeatureLocator()</title>
      <link>https://community.esri.com/t5/python-questions/error-999999-with-arcpy-geocoding/m-p/1526095#M71301</link>
      <description>&lt;P&gt;If the portal uses &lt;A href="https://enterprise.arcgis.com/en/portal/11.3/administer/windows/about-configuring-portal-authentication.htm#ESRI_SECTION1_AA40A239CE81485CB4F7A91BBDDFE845" target="_blank" rel="noopener"&gt;built-in security&lt;/A&gt;, provide a username and password.&lt;/P&gt;&lt;P&gt;gis = GIS(&lt;SPAN class=""&gt;"&amp;nbsp;portal_url"&lt;/SPAN&gt;, &lt;SPAN class=""&gt;"username"&lt;/SPAN&gt;, &lt;SPAN class=""&gt;"password"&lt;/SPAN&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, maybe use,&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.features import FeatureLayer

for locator in [locators[2]]:
    try:
        print(f"Creating locator for: {locator['name']}")
        layer = FeatureLayer(locator['link'])
        output_fc = "temp_layer"
        arcpy.conversion.FeatureClassToFeatureClass(layer, "in_memory", output_fc)

        arcpy.geocoding.CreateFeatureLocator(
            in_features=output_fc,
            output_locator=os.path.join(r"G:\Water_and_Gas_Operations\ArcGIS\Feature Locator Files", locator['name']),
            search_fields=locator['map'], 
            locator_fields=locator.get('etc')
        )
    except Exception as e:
        print(f"Error creating locator for {locator['name']}: {e}")&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 22 Aug 2024 19:55:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-999999-with-arcpy-geocoding/m-p/1526095#M71301</guid>
      <dc:creator>TonyAlmeida</dc:creator>
      <dc:date>2024-08-22T19:55:02Z</dc:date>
    </item>
  </channel>
</rss>

