Field Mapping when creating a composite address locator

639
1
Jump to solution
07-21-2021 03:09 PM
JoeBorgione
MVP Emeritus

When creating a single or even a multirole locator in ArcGIS Pro, I like to capture the output from the tool so I can easily format the various parameters into a python script.  For example, the field mapping parameter for a multi role locator looks like this once I get it into python:

fieldMapping = "'PointAddress.HOUSE_NUMBER AddressPoints_Erase.ADDR_HN';"\
                   "'PointAddress.STREET_PREFIX_DIR AddressPoints_Erase.ADDR_PD';"\
                   "'PointAddress.STREET_NAME AddressPoints_Erase.ADDR_SN';"\
                   "'PointAddress.STREET_SUFFIX_TYPE AddressPoints_Erase.ADDR_ST';"\
                   "'PointAddress.STREET_SUFFIX_DIR AddressPoints_Erase.ADDR_SD';"\
                   "'PointAddress.SUB_ADDRESS_UNIT AddressPoints_Erase.UNIT_DESIG';"\
                   "'PointAddress.CITY AddressPoints_Erase.CITY';"\
                   "'PointAddress.POSTAL AddressPoints_Erase.ZIP_CODE';"\
                   "'StreetAddress.HOUSE_NUMBER_FROM_LEFT Centerlines_Erase.FROMADDR_L';"\
                   "'StreetAddress.HOUSE_NUMBER_TO_LEFT Centerlines_Erase.TOADDR_L';"\
                   "'StreetAddress.HOUSE_NUMBER_FROM_RIGHT Centerlines_Erase.FROMADDR_R';"\
                   "'StreetAddress.HOUSE_NUMBER_TO_RIGHT Centerlines_Erase.TOADDR_R';"\
                   "'StreetAddress.STREET_PREFIX_DIR Centerlines_Erase.PREDIR';"\
                   "'StreetAddress.STREET_NAME Centerlines_Erase.NAME';"\
                   "'StreetAddress.STREET_SUFFIX_TYPE Centerlines_Erase.POSTTYPE';"\
                   "'StreetAddress.STREET_SUFFIX_DIR Centerlines_Erase.POSTDIR';"\
                   "'StreetAddress.CITY_LEFT Centerlines_Erase.INCMUNI_L';"\
                   "'StreetAddress.CITY_RIGHT Centerlines_Erase.INCMUNI_R';"\
                   "'StreetAddress.POSTAL_LEFT Centerlines_Erase.ZIPCODE_L';"\
                   "'StreetAddress.POSTAL_RIGHT Centerlines_Erase.ZIPCODE_R'"

It's easy to split the parameters at the semicolon, and makes it much easier to read in the python script itself.  However, when it comes to splitting out the parameters of a composite address locator, it's not as straight forward.  Here is the output from the tool: 

JoeBorgione_0-1626904773957.png

That's one long line.  I can copy that single line into my python script but I can't read it since it goes on for about a mile:

fieldMap = r'Address "Address or Place" true true false 100 Text 0 0,First,#,N:\GIS\Geocoding\NewGeocoding\MsdMultiRoleLocator.loc,Address,0,0,N:\GIS\Geocoding\NewGeocoding\NonMSDMultiRoleLocator.loc,Address,0,0'

Does anyone know where to put the line breaks in as shown in the first python window?

@ShanaBritt 

@BradNiemand 

 

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

Accepted Solutions
JoeBorgione
MVP Emeritus

It seems like I figured it out:\

 

    
    addressLocators = r"N:\GIS\Geocoding\CityWorksLocators\Locators\MsdMultiRoleLocator.loc Msd;"\
                      r"N:\GIS\Geocoding\CityWorksLocators\Locators\NonMSDMultiRoleLocator.loc NonMSD;"\
                      r"N:\GIS\Geocoding\CityWorksLocators\Locators\SingleRoleParcelLocator.loc Parcel"
    
    #fieldMap = r'"Address or Place" true true false 100 Text 0 0,First,#,N:\GIS\Geocoding\CityWorksLocators\Locators\MsdMultiRoleLocator.loc,Address,0,0,N:\GIS\Geocoding\CityWorksLocators\Locators\NonMSDMultiRoleLocator.loc,Address,0,0,N:\GIS\Geocoding\CityWorksLocators\Locators\SingleRoleParcelLocator.loc,Address,0,0'

    fieldMap = 'Address "Address or Place" true true false 100 Text 0 0,First,#,;'\
                r'N:\GIS\Geocoding\CityWorksLocators\Locators\MsdMultiRoleLocator.loc,Address,0,0,;'\
                r'N:\GIS\Geocoding\CityWorksLocators\Locators\NonMSDMultiRoleLocator.loc,Address,0,0,;'\
                r'N:\GIS\Geocoding\CityWorksLocators\Locators\SingleRoleParcelLocator.loc,Address,0,0'
    
    selectionCriteria = "MsdLocator #;"\
                        "NonMsdLocator #;"\
                        "Parcel #"
                            
    outLocator = r'N:\GIS\Geocoding\CityWorksLocators\Locators\CityWorksComposite.loc'
That should just about do it....

View solution in original post

0 Kudos
1 Reply
JoeBorgione
MVP Emeritus

It seems like I figured it out:\

 

    
    addressLocators = r"N:\GIS\Geocoding\CityWorksLocators\Locators\MsdMultiRoleLocator.loc Msd;"\
                      r"N:\GIS\Geocoding\CityWorksLocators\Locators\NonMSDMultiRoleLocator.loc NonMSD;"\
                      r"N:\GIS\Geocoding\CityWorksLocators\Locators\SingleRoleParcelLocator.loc Parcel"
    
    #fieldMap = r'"Address or Place" true true false 100 Text 0 0,First,#,N:\GIS\Geocoding\CityWorksLocators\Locators\MsdMultiRoleLocator.loc,Address,0,0,N:\GIS\Geocoding\CityWorksLocators\Locators\NonMSDMultiRoleLocator.loc,Address,0,0,N:\GIS\Geocoding\CityWorksLocators\Locators\SingleRoleParcelLocator.loc,Address,0,0'

    fieldMap = 'Address "Address or Place" true true false 100 Text 0 0,First,#,;'\
                r'N:\GIS\Geocoding\CityWorksLocators\Locators\MsdMultiRoleLocator.loc,Address,0,0,;'\
                r'N:\GIS\Geocoding\CityWorksLocators\Locators\NonMSDMultiRoleLocator.loc,Address,0,0,;'\
                r'N:\GIS\Geocoding\CityWorksLocators\Locators\SingleRoleParcelLocator.loc,Address,0,0'
    
    selectionCriteria = "MsdLocator #;"\
                        "NonMsdLocator #;"\
                        "Parcel #"
                            
    outLocator = r'N:\GIS\Geocoding\CityWorksLocators\Locators\CityWorksComposite.loc'
That should just about do it....
0 Kudos