2

I would like use something like the "US Address - One Range"(Commonly used locator styles) where there is a from address and to address. However it requires side of street information and my range of addresses are in a single field.

My reference data looks like this:

+----------------+---------+
|     Field      |  Value  |
+----------------+---------+
| Shape          | Polygon |
| Street_Number  | 45-55   |
| Street_Name    | Foo     |
+----------------+---------+

So overall I would like to Geocode multiple addresses to a single point by creating a Address Locator that takes a range of house numbers.

I have looked at this Customizing ArcGIS 10 locators (An Esri Geocoding Technical Paper)

It looks promising but much more complicated than what I am looking for. Is this the only way to Geocode my reference data?

0

1 Answer 1

0

I ended up generating the missing points in the range. (45-55 becomes 45,46,47,..,55) with all the points in the range stacked on top of each other using this script.

import arcpy
import os

def main():
    arcpy.env.overwriteOutput = True
    InFC = arcpy.GetParameterAsText(0)
    OutFC = arcpy.GetParameterAsText(1)

    Folder = os.path.dirname(OutFC)
    Name   = os.path.basename(OutFC)

    desc = arcpy.Describe(InFC)
    SR   = desc.spatialReference

    if arcpy.Exists(OutFC):
        arcpy.DeleteRows_management(OutFC)
    else:
        arcpy.CreateFeatureclass_management(Folder, Name,"POINT", template = 
InFC, spatial_reference = SR)

    fillHouseNumberRange(InFC, OutFC)


def fillHouseNumberRange(InFeat, OutFeat):
    in_fields = ["SHAPE@", "Street_Number", "Street_Name"]
    out_fields = ["SHAPE@XY", "Street_Number", "Street_Name"]
    with arcpy.da.InsertCursor(OutFeat, out_fields) as iCur, \
            arcpy.da.SearchCursor(InFeat,in_fields) as sCur:
        for sRow in sCur:
            cent = sRow[0].centroid
            st_nbr = sRow[1]
            fename = sRow[2]
            if len(st_nbr.split("-")) == 2:
                try:
                    st_range = st_nbr.split("-")
                    start = int(st_range[0])
                    end = int(st_range[1])
                    for i in range(start, end+1):
                        iCur.insertRow([(cent.X,cent.Y), str(i), fename])
                except:
                    iCur.insertRow([(cent.X,cent.Y), st_nbr, fename])
            else:
                iCur.insertRow([(cent.X,cent.Y), st_nbr, fename])




if __name__ == "__main__":
    main()

Then made an address locator with the "US Address - Single House" style with the new out features.

Your Answer

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

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