views:

19

answers:

1

The project I'm working on requires me to find intersections near a point (searching a street centerline layer). For 90+% of my searches, I seem to be getting the appropriate results, however in certain instances I'm getting intersections that are technically intersections as far as ArcObjects is concerned, but not as far as what I need.

As an example, if I search for the intersection nearest to a certain point on S. Main St, I should get the intersection of S. Main St & First St. However, that intersection happens to be the intersection of N. Main St, S. Main St, W. First St and E. First St. As a result of this, when I do a reverse geocode on the point searching for intersections, I get a single result of N. Main St & S. Main St.

Is there any way to get all intersection at that same point rather than just one intersection? If not, is there a way to filter available results?

My current code below is what ends up with the value of N. Main & S. Main in the intersectionName variable.

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

ILocator 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;

try
{
       IPropertySet propSet = reverseGeo.ReverseGeocode(pnt, true);
       intersectionName = propSet.GetProperty("Street").ToString();
}...
A: 

Assuming your locator references just one polyline featureclass (i.e. is not a composite locator) I'd try replacing the reversegeocoder with a spatial search against the polyline featureclass (IFeatureClass.Search) with a spatialfilter based on a 500 meter search envelope.

Kirk Kuykendall