Select to view content in your preferred language

Create Composite Locator (Python - ISSUE)

3313
11
09-05-2014 07:03 AM
ErnestoCarreras3
Occasional Contributor

I am exporting a Create Composite Locator model to python scrip but is not following the parameters set for the Field Mapping. The default field mapping settings are Street, City, State, and ZIP. I want to change them for Address, City, Region, and Postal. It works perfectly when executed from the canvas or dialog but it does not when executed from IDLE.

0 Kudos
11 Replies
JeffWard
Regular Contributor II

When you say "does not work when executed from IDLE" do you mean the script errors out, or does it complete but not with the results you wanted?

Jeff Ward
Summit County, Utah
0 Kudos
ErnestoCarreras3
Occasional Contributor

It executes successfully but not with the desired results for Field Mapping.

0 Kudos
JeffWard
Regular Contributor II

When you open the script does the field map parameter show the changes you made in the field properties in model builder?  The field map is the second parameter, it comes after the list of locators.

Jeff Ward
Summit County, Utah
0 Kudos
ErnestoCarreras3
Occasional Contributor

Yes. I am including the properties below... I also noticed the following:

Street,0,0 ----> replaced ----> Address,0,

State,0,0 ----> replaced ----> Region,0,0

ZIP,0,0 ----> replaced ----> Postal,0,0

I tried also by replacing those too but nothing

Field_Map = "Address \"Address\" true true false 50 Long 0 0 ,First,#,\\\\ServerName\\StreetMapPremium\\Locators\\USA_PointAddress,Street,0,0,\\\\ServerName\\StreetMapPremium\\Locators\\USA_StreetAddress,Street,0,0,\\\\ServerName\\StreetMapPremium\\Locators\\USA_StreetName,Street,0,0;City \"City or Placename\" true true false 40 Text 0 0 ,First,#,\\\\ServerName\\StreetMapPremium\\Locators\\USA_PointAddress,City,0,0,\\\\ServerName\\StreetMapPremium\\Locators\\USA_StreetAddress,City,0,0,\\\\ServerName\\StreetMapPremium\\Locators\\USA_StreetName,City,0,0;Region \"Region\" true true false 50 Long 0 0 ,First,#,\\\\ServerName\\StreetMapPremium\\Locators\\USA_PointAddress,State,0,0,\\\\ServerName\\StreetMapPremium\\Locators\\USA_StreetAddress,State,0,0,\\\\ServerName\\StreetMapPremium\\Locators\\USA_StreetName,State,0,0;Postal \"Postal\" true true false 50 Long 0 0 ,First,#,\\\\ServerName\\StreetMapPremium\\Locators\\USA_PointAddress,ZIP,0,0,\\\\ServerName\\StreetMapPremium\\Locators\\USA_StreetAddress,ZIP,0,0,\\\\ServerName\\StreetMapPremium\\Locators\\USA_StreetName,ZIP,0,0"

0 Kudos
JeffWard
Regular Contributor II

Ernesto,

It sounds like you may want to customize your locator styles that you create locators from, or modify the individual locators you have in your composite locator.  Here is a document that gets into customizing locators in great detail.

You can customize each individual locator's xml file and modify the <input> tags to say Address instead of Street, Region instead of State etc.  To do that browse to the location of your locator and open the locatorname.loc.xml file the input tags are at the top.

Are you creating a large number of composite locators?  I'm wondering why you would need to create a composite locator in a script.

Jeff Ward
Summit County, Utah
0 Kudos
JeffWard
Regular Contributor II

I was able to modify the locators' xml files that I used in a composite locator and have the Address, Region and Postal inputs show up in the new composite locator created from a script that I exported from a model.

If you want to change the locator styles that are used to create new locators you can go to the installation directory (C:\Program Files (x86)\ArcGIS\Desktop10.2\Locators) and work with those xml documents - I would make copies of the originals and paste them to the same directory, and modify the copy.  One of those files in the US is called USAddress.lot.xml.  If you only want to work with one style, you can open the .lot.xml file you copied, go to the <ref_data_styles> tag and delete all of the <ref_data_style> sections except the one you want to modify, then change the <name> property to My Single House if you are working with the Single House style.  If you leave all of the others in there, and don't change any names, you will see two of each style listed when you create a locator.


CompositeLocator.jpg

Jeff Ward
Summit County, Utah
0 Kudos
ErnestoCarreras3
Occasional Contributor

Thanks Jeff…really appreciated for your help. I still can get why it works when executed from the canvas and/or model dialog but not when exported to python. I will definitely look into this and implement your suggestion within my code. The reason I want to automate this is because it’s for a production sever with limited access. The people who are going to be executing the tools are not GIS power users and want I want to make their life easier. Again, thanks for your assistance regarding this matter. Hopefully, someone from Esri reads this thread and dig into the issue in order to implement the proper fixes. Kind regards. - EC

0 Kudos
JeffWard
Regular Contributor II

If you want other folks to chime in, you might want to change the status to unanswered.  You marked my first reply as the answer to your question.

Jeff Ward
Summit County, Utah
0 Kudos
ErnestoCarreras3
Occasional Contributor

No sure how to do that...

0 Kudos