0

我有一条折线和一个点要素类。我在 Point 图层上为 IPolyline5 的 FromPoint 和 ToPoint 创建了一个点要素,如下所示:

IFeature pointFeature1 = pointFeatureClass.CreateFeature ();
pointFeature1.Shape = polyline.FromPoint;
IFeature pointFeature2 = pointFeatureClass.CreateFeature ();
pointFeature2.Shape = polyline.ToPoint;

稍后,我通过如下方法运行起点和终点几何,从折线要素类中查找所有相交的折线要素。

ISpatialFilter filter = new SpatialFilter ();
filter.Geometry = pointGeometry;
filter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;
IFeatureCursor cursor = lineFeatureClass.FeatureClass.Search (filter, false);

至少,相交过滤器应该找到我得到 2 点的折线。奇怪的是,它适用于 FromPoint,但不适用于 ToPoint。

两个要素类都使用相同的地理坐标系和投影坐标系。

我希望我在做一些愚蠢的事情,但就是不知道是什么。

4

3 回答 3

0

通过将点缓冲 0.001,我让它与 esriSpatialRelIntersects 一致地工作。

于 2012-02-08T06:36:42.447 回答
0

从现有特征创建新特征时,不应使用直接参考,而应使用 ShapeCopy。尝试将您的第一个块更改为:

pointFeature1.Shape = polyline.FromPoint.ShapeCopy;
pointFeature2.Shape = polyline.ToPoint.ShapeCopy;
于 2012-02-08T09:19:11.917 回答
0

代替

pointFeature1.Shape = polyline.FromPoint;

采用

PointFeature1.Shape = ((polyline.FromPoint as IPoint) as IFeature).ShapeCopy;

并且对于

pointFeature2.Shape = polyline.ToPoint;

采用

PointFeature1.Shape = ((polyline.ToPoint as IPoint) as IFeature).ShapeCopy;
于 2017-04-19T11:31:58.690 回答