# Create Locator: Change Match Out Of Range Default to NO

900
8
12-03-2020 10:59 AM
MVP Esteemed Contributor

ArcGIS Pro 2.6

Can I change the default setting from yes to no when creating a street address role locator rather than changing it in the locator properties?  For that matter, can I change any of the other properties like Scores etc in a python scripting environment rather than manually after the fact?

That should just about do it....
Tags (2)
1 Solution

Accepted Solutions
Esri Regular Contributor

Joe,

If you use updateLocator () after modifying the locator settings in Python, the properties get persisted into the locator for future use.  If you don't call the updateLocator () method, the properties will only be applied for that session of geocoding in Python.

8 Replies
MVP Esteemed Contributor

Introduction to locator properties and options—ArcGIS Pro | Documentation

##### Note:

To modify the locator's settings, it must be either added to the project or accessed from a folder connection in the Catalog pane under the Folders category

If that makes any sense to you.  I don't have one to check or test.

.

... sort of retired...
MVP Esteemed Contributor

I thought there were some new python tools that would make it easier that were coming down the pike....

That should just about do it....
MVP Esteemed Contributor

Locator—ArcGIS Pro | Documentation

... sort of retired...
MVP Esteemed Contributor

Thanks Dan!  I this might have been what I was thinking of ,

That should just about do it....
MVP Esteemed Contributor

Unfortunately, it appears that the only way to change properties of a locator and have them permanent is to interact with the locators properties pane. If I were to geocode a table of addresses using python the Locator class and properties discussed would be the way to go:

import arcpy
''' set the property'''
locator = arcpy.geocoding.Locator(locatorPath)
locator.matchOutOfRange = False

''' do the geocoding '''


That should just about do it....
Esri Regular Contributor

Joe,

If you use updateLocator () after modifying the locator settings in Python, the properties get persisted into the locator for future use.  If you don't call the updateLocator () method, the properties will only be applied for that session of geocoding in Python.

MVP Esteemed Contributor

Thanks for pointing that out @BradNiemand !

That should just about do it....
MVP Esteemed Contributor

Just for fun, here is an example of creating a single role street address locator using a feature service for the data source.  After the locator is created, a couple properties get changed from the default:

import arcpy

arcpy.env.overwriteOutput = True
arcpy.SetLogHistory(False)

'''Create the locator'''
outLocator = r'M:\path\to\MyStreetLocator'
language = 'ENG'
country = 'USA'

arcpy.geocoding.CreateLocator(country, inTable, fieldMapping, outLocator, language)

'''With the Locator created set the default properties'''

locatorPath = f'{outLocator}.loc'
locator = arcpy.geocoding.Locator(locatorPath)

locator.matchOutOfRange = False
locator.minCandidateScore = 75
locator.minMatchScore = 75
locator.updateLocator()