4

I am creating a model that processes a large road dataset, then creates an address locator from the roads. The Create Address Locator tool does not allow me to set options like Spelling Sensitivity or Minimum Candidate Score.

Is it possible to set these options in ModelBuilder (or at least, within an ArcPy Python script)?

I'm using ArcGIS 10, but I'm also interested in whether it's possible in 10.1.

PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked Apr 30, 2013 at 20:13
4
  • I think you will have to create the locator and then open ArcMap to change the settings. Awkward, but how many locators do you need? Commented Apr 30, 2013 at 21:22
  • Just the one, but the customer's GIS techs are supposed to be able to run the data processing model whenever they need to update their data for our custom software. It looks like we'll just need to train them to set up the geocoder manually. Like you said, awkward. Commented Apr 30, 2013 at 21:41
  • 2
    This is not possible at 10.1 either. Commented May 1, 2013 at 10:47
  • 1
    @Arabella I think you should make your Comment into an Answer because it answers the question. Can I also suggest that someone creates an ArcGIS Idea for this (and link to it here) if it is important to your work. Commented May 2, 2013 at 10:44

3 Answers 3

3

The .loc files generated by an address locator are plain text files. Therefore, you can modify any settings that are specified in the .loc file without the need for an arcpy function.

For example, to change the minimum match score from the default to 70%:

locator_fn = 'my_address_locator.loc'
locator_file = open(locator_fn,'a') # open for appending
locator_file.writelines('MinimumMatchScore = 70')
locator_file.close()

You will need to do some experimenting to find out the exact syntax. The easiest way is to change the settings in ArcMap, and examine the .loc file before and after to see which lines have been written.

answered Aug 26, 2014 at 22:53
1
  • Thanks for this hint. I wish I'd remembered this earlier when struggling with the output from a composite locator. It was not respecting the settings of the component locators to write the ref_id. Apparently, the default when you create a composite locator in ArcCatalog is: WriteReferenceIDField = FALSE. And you can't change this property in ArcCatalog either. Editing the text file was such an obvious solution that I missed. I am posting this in case someone else stumbles on this issue. Commented May 4, 2017 at 13:40
2

It is currently not possible at 10.1 to use arcpy to change locator settings.

answered May 2, 2013 at 19:27
1

To expand on @amball's answer. It took me a few hours to figure out how to change one of the setting with Python so I am posting this here. Note: I am using ArcGIS 10.3

The ArcPy API does not have access to modify all the properties of an address locator.

You will need to edit the myLocator.loc.xml directly using a xml parser.

Note: The white space in an xml document does not have an effect on its meaning also the nodes can be moved around with out changing its semantics. To have a more robust program you need to use software that is aware of this and in this case use an xml parser.

Here is an example to change the Minimum Match Score of an Address Locator.

from xml.dom import minidom
locator_path = "AddressLocators\myLocator.loc.xml"
minimum_match_score = 99
xmldoc = minidom.parse(locator_path)
properties = xmldoc.getElementsByTagName("prop")
for p in properties:
 if p.getAttribute('name') == 'MinimumMatchScore':
 p.firstChild.replaceWholeText(minimum_match_score)
with open(locator_path,'w') as f:
 f.write(xmldoc.toxml(encoding="utf-8"))
answered Jun 28, 2018 at 14:02

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.