Create Locator in Model Builder with Custom Style

1272
4
Jump to solution
10-25-2016 10:11 AM
JoeBorgione
MVP Emeritus

When one uses the Create Address Locator tool in model builder, and then exports the model to a .py script, the  line of the script that does the actual creation starts with:

 

arcpy.CreateAddressLocator_geocoding("US Address - Dual Ranges", etc etc etc

 

In this example I used the out of the box ESRI locator style.

 

How does model builder / arcpy know what locator style to use?

 

I ask because I’m trying to build a model / .py script that uses a custom locator style and when I do, it errors out with a  00042 error: Failed to create the address locator. I can run the Create Locator tool and the custom style and mapping the appropriate fields without any problem: in model builder it bails out.

 

Error 00042 provides the following:

 

Description

The address locator cannot be created.

Solution

Check that you have the following:

  • Permission to write to the disk or database
  • Enough disk space for the address locator you are trying to create
  • Valid network or database connection
  • Valid geocoding rule files
  • Valid address locator style

The description is pretty obvious, but the solution isn’t.  The first three items I have covered.  But the rules and style validity have me stymied.  How can I convince the model builder and subsequently arcpy that what I’m providing is valid?

That should just about do it....
1 Solution

Accepted Solutions
JoeBorgione
MVP Emeritus

I was able to get resolution to my problem, so I'll post it here for future generations.

Apparently the create locator tool has an issue (I hasten to use the word bug) when it's used in a model.  Anytime you have a primary data source that couples with an alternate names, you need to map the appropriate fields in each that contain the JOINID.  That's fine when you run the tool manually, mapping those fields are not a problem.  But....  When you use the tool in a model and subsequent python scripts, the setting is lost if you don't make sure it's saved.  Follow along the illustrations below as I'm a firm believer that a picture is worth a thousand words:

What you need to do to make sure this 'sticks' in the model is to apply it, and save your model.  Then, re-edit your model and double check; it should be empty, so map it again, apply it again, and save it again.  You should be good to go.

I also learned a trick today that would saved me a ton of head and heartache.  Running a model from within model builder with the run arrow button will give you a better error description:

When it hits the problem and quits, not only will you see notation of the 00042 error, but a much more verbose and useful sql error:

Hey Dan;  I feel weird marking my own response to my own post as the correct answer...  Would you be so kind?

Dan_Patterson

That should just about do it....

View solution in original post

4 Replies
DanPatterson_Retired
MVP Emeritus

Joe... What is this stuff in Create Address Locator—Help | ArcGIS for Desktop about not storing locators in geodatabases anymore (aka 10.4 is the last version that supports this).  Does that imply that you can save to disk and get something you can read?

0 Kudos
JoeBorgione
MVP Emeritus

I haven't stored locators within a geodatabase for several years now Dan.  Used to all the time but got talked out of it in a discussion on the old forum in the 9.1 or .3 days.  I always create a directory called.... Locators to store them.  The ones I'm dealing with now are on the 'C' drive of a virtual machine, at least that's just what the vm thinks:  everything is on the SAN.

Strange thing about this problem is everything checks out and seems like it should work.  I can run the tool manually in the same workspace, run it in  a model with an out of the box ESRI locator with the same data, no problem. Finally heard back from the developer and he says it should work.  Yeah.  It should, but it dosen't for now....

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

I was able to get resolution to my problem, so I'll post it here for future generations.

Apparently the create locator tool has an issue (I hasten to use the word bug) when it's used in a model.  Anytime you have a primary data source that couples with an alternate names, you need to map the appropriate fields in each that contain the JOINID.  That's fine when you run the tool manually, mapping those fields are not a problem.  But....  When you use the tool in a model and subsequent python scripts, the setting is lost if you don't make sure it's saved.  Follow along the illustrations below as I'm a firm believer that a picture is worth a thousand words:

What you need to do to make sure this 'sticks' in the model is to apply it, and save your model.  Then, re-edit your model and double check; it should be empty, so map it again, apply it again, and save it again.  You should be good to go.

I also learned a trick today that would saved me a ton of head and heartache.  Running a model from within model builder with the run arrow button will give you a better error description:

When it hits the problem and quits, not only will you see notation of the 00042 error, but a much more verbose and useful sql error:

Hey Dan;  I feel weird marking my own response to my own post as the correct answer...  Would you be so kind?

Dan_Patterson

That should just about do it....
DanPatterson_Retired
MVP Emeritus

Done... glad you worked this out for sure

0 Kudos