ERROR 000005: Could not open the address locator.

2132
11
11-27-2019 07:24 AM
JoeBorgione
MVP Emeritus

ArcGis Pro 2.4 and/or ArcGIS 1.6.1

I am attempting to automate the creation of a composite locator using the Create Composite Locator tool/syntax in a python script.  I keep getting error as shown in the title of this thread.

Here is my function:

locatorsDir = r'\\SLCISARCGIS10-T\arcgisresources\common\geocode\test'

def createCompositeLocator(locatorsDir):
    #arcpy.env.workspace = locatorsDir
    outLocator = '{}\\CompositePY'.format(locatorsDir)
    addrSF = '{}\\AddressSF'.format(locatorsDir)
    addrSH = '{}AddressSH'.format(locatorsDir)
    centerLines = '{}\\Centerline'.format(locatorsDir)
    parcels = '{}\\Parcels'.format(locatorsDir)
    #locators = '{} AddressSF; {} AddressSH; {} Centerline; {} Parcels'.format(addrSF,addrSH, centerLines,parcels)
    locators = addrSF + ' AddrSF;' + addrSH + ' AddrSH;' + centerLines + ' Centerline;' + parcels + ' Parcels'
    

    
    
    
    fieldMap  = """
                   SingleKey "Key" true true false 100 Text 0 0 ,First,#,
                   \\slcisarcgis10-t\arcgisresources\common\geocode\Test\AddressSF,SingleKey,0,0,
                   \\slcisarcgis10-t\arcgisresources\common\geocode\Test\AddressSH,Street,0,0,
                   \\slcisarcgis10-t\arcgisresources\common\geocode\Test\Centerline,Street,0,0,
                   \\slcisarcgis10-t\arcgisresources\common\geocode\Test\Parcels,SingleKey,0,0
                 """
    arcpy.geocoding.CreateCompositeAddressLocator(locators,fieldMap,"",outLocator)‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

The contents of FieldMap comes right out of the create composite locator tool history (Pro) or the geoprocessing results (ArcGIS).  The tool executes just fine in either application.  I cannot figure out what/why the error is telling me...

Eric Anderson

Brad Niemand

That should just about do it....
0 Kudos
11 Replies
JoeBorgione
MVP Emeritus

Having exhausted everything suggested thus far, I'm wondering if its a network/permissions issue.  Seems odd though since I can create all the participating locators in the same workspace. Composites are a little funky though: I always use 

import arcpy
arcpy.env.overwriteOutput = True

at the beginning of every script: I had to manually delete after I created it in my J: drive...

That should just about do it....
0 Kudos
JoeBorgione
MVP Emeritus

I got it to work. Sort of.

Line 11 in the original script appears to be the problem child:

locators = addrSF + ' AddrSF;' + addrSH + ' AddrSH;' + centerLines + ' Centerline;' + parcels + ' Parcels'

I copied the format right out of the online help.

What I finally go to work is:

locators = r'\\slcisarcgis10-t\arcgisresources\common\geocode\Test\AddressSF.loc AddressSF;\\slcisarcgis10-t\arcgisresources\common\geocode\Test\AddressSH.loc AddressSH;\\slcisarcgis10-t\arcgisresources\common\geocode\Test\Centerlines.loc Centerlines;\\slcisarcgis10-t\arcgisresources\common\geocode\Test\Parcels.loc Parcels'

Which is really ugly and since the unc path  

\\slcisarcgis10-t\arcgisresources\common\geocode\Test 

is a variable within the script, there exists yet another challenge....

That should just about do it....
0 Kudos