如何在 ArcObjects 中通过 ReverseGeoCoding 查找多个交集结果?
我正在从事的项目要求我找到某个点附近的交叉路口(搜索街道中心线层)。对于 90% 以上的搜索,我似乎得到了适当的结果,但在某些情况下,我得到的交集在 ArcObjects 方面是技术上的交集,但达不到我需要的程度。
举个例子,如果我搜索距离 S. Main St 上某个点最近的交叉路口,我应该得到 S. Main St 和 S. Main St 的交叉路口。但是,该交叉点恰好是 N. Main St、S. Main St、W. First St 和 E. First St 的交叉点。因此,当我在搜索点上进行反向地理编码时交叉路口,我得到 N. Main St & 的单个结果S. Main St.
有没有办法让所有交叉路口都在同一点,而不仅仅是一个交叉路口?如果没有,有没有办法过滤可用的结果?
我当前的下面的代码最终得到的是 N.Main & 的值。 S.Main 在 junctionName 变量中。
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();
}...
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();
}...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
假设您的定位器仅引用一个折线要素类(即不是复合定位器),我会尝试将反向地理编码器替换为针对折线要素类(IFeatureClass.Search)的空间搜索以及基于 500 米搜索包络的空间过滤器。
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.