Select to view content in your preferred language

Reverse Geocoding To Find Multiple Points

620
1
06-29-2010 09:22 AM
MatthewRobold
New Contributor
I'm working my way through a project that requires determining nearest intersections to addresses.  Sounds simple enough, but I'm running into difficulties when the intersection returned is not what the customer would consider a "real" intersection.

E.G.

Address is: 101 S. Main St
Geocode it to find the point, and reverse geocode the point against a locator looking for intersections.  The result I want back is "S. Main St & W. First St" but instead I'm getting "S. Main St & N. Main St" because the nearest intersection is the intersection of N. Main, S. Main, E. First and W. First.

Is there a way with the reverse geocoder to get all results rather than just one so that I can iterate through the results and eliminate results like "N. Main & S. Main" or is there a way to better filter the results at the get-go?

            ILocatorManager2 locMgr;
            ILocatorWorkspace locWorkspace;
            ILocator locator;

            locMgr = new LocatorManagerClass();
            locWorkspace = locMgr.GetLocatorWorkspace(this.wksp);

            locator = locWorkspace.GetLocator("Streets_AddressLocator");

            if (locator == null)
                return string.Empty;

            IReverseGeocoding reverseGeo = locator as IReverseGeocoding;
            IReverseGeocodingProperties reverseProps = reverseGeo as IReverseGeocodingProperties;
            reverseProps.SearchDistance = 500;
            reverseProps.SearchDistanceUnits = esriUnits.esriMeters;

            IIntersectionGeocoding intersect = locator as IIntersectionGeocoding;

            if (intersect == null)
                return string.Empty;

            try
            {
                IPropertySet propSet = reverseGeo.ReverseGeocode(pnt, true);
                IAddressInputs inputs = reverseGeo as IAddressInputs;
                IFields fields = inputs.AddressFields;
                intersectionText = propSet.GetProperty("Street").ToString();
            }...
0 Kudos
1 Reply
BradNiemand
Esri Regular Contributor
Unfortunately no.  Reverse geocode just returns the closest address to the point.  Is the reverse geocoded intersection on the wrong side of the segment?  If so, you could try this:

1. Geocode the address
2. Get the "From" and "To" values from that geocoded address
3. Geocode the "From" address and the "To" address
4. Reverse geocode the result of each.

I.E.
Address is: 101 S. Main St
From is: 100
To is: 200

Geocode 100 S. Main St. and 200 S. Main St.
Reverse geocode the results and one of the two will be the intersection that you want.  You could even use the percent along to determine if the original geocoded address is closer to the "To" or the "From" address.  In this case you would just need to reverse geocode just one of the two.

Brad
0 Kudos