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.

  • 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? – gm70560 Apr 30 '13 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. – Tanner Apr 30 '13 at 21:41
  • 2
    This is not possible at 10.1 either. – Cindy Jayakumar May 1 '13 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. – PolyGeo May 2 '13 at 10:44
2

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

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

4

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.

  • 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. – gischimp May 4 '17 at 13:40
0

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"))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.