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 StGeocode 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();
}...