goodmangis
外卖仔
外卖仔
  • 注册日期2006-03-10
  • 发帖数34
  • QQ
  • 铜币244枚
  • 威望2点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • GIS帝国铁杆
阅读:2289回复:0

[求助]Point空间检索问题

楼主#
更多 发布于:2010-08-30 15:51
<P>有两个数据层,分别为Polyline和Point层,现将Polyline中的节点顺序取出以Point的形式去检索Point层的数据。其中,Polyline中的节点和Point层的点是Snap过的,可是利用下面的代码去检索总是检索不到(有几个可以),使用菜单的功能却是可以的。</P>
<P>不知道有人遇到过类似情况,ESRI主页中有类似情况,可惜没有解答!,见</P>
<P><a href="http://forums.esri.com/Thread.asp?c=93;f=993;t=107851;g=1" target="_blank" >http://forums.esri.com/Thread.asp?c=93;f=993;t=107851;g=1</A></P>
<P>Sub test()</P>
<P>''按照给定Polyline的节点顺序检索剖分节点<BR>    Dim pMxDoc As IMxDocument<BR>    Set pMxDoc = ThisDocument<BR>    Dim pMap As IMap<BR>    Set pMap = pMxDoc.FocusMap<BR>    <BR>    <BR>    Dim pFLayer1 As IFeatureLayer, pFLayer2 As IFeatureLayer<BR>    Dim pFClassPolyline As IFeatureClass, pFClassPoint As IFeatureClass<BR>  <BR>    Set pFLayer1 = pMap.Layer(0)<BR>    Set pFClassPolyline = pFLayer1.FeatureClass<BR>    Set pFLayer2 = pMap.Layer(1)<BR>    Set pFClassPoint = pFLayer2.FeatureClass<BR>    <BR>    Dim pFeatureStartline As IFeature<BR>    Set pFeatureStartline = pFClassPolyline.GetFeature(0)<BR>    Dim pPonitColl As IPointCollection<BR>    Set pPonitColl = pFeatureStartline.Shape<BR>    <BR>    Dim pSpatialfilter As ISpatialFilter<BR>    Dim pFCursor As IFeatureCursor<BR>    Dim pFeature As IFeature<BR>    Set pSpatialfilter = New SpatialFilter</P>
<P>    Dim i As Integer<BR>    Dim pTopo As ITopologicalOperator<BR>    Dim pGeometry As IGeometry<BR>    <BR>    For i = 0 To pPonitColl.PointCount - 1<BR>        <BR>        Set pGeometry = pPonitColl.Point(i)<BR>                'Debug.Print i, pPonitColl.Point(i).X, pPonitColl.Point(i).Y<BR>        With pSpatialfilter<BR>            Set .Geometry = pGeometry<BR>            .GeometryField = pFClassPoint.ShapeFieldName<BR>            .SpatialRel = esriSpatialRelIntersects<BR>        End With<BR>        Set pFCursor = pFClassPoint.Search(pSpatialfilter, True)<BR>        Set pFeature = pFCursor.NextFeature 'Get the first feature<BR>        If Not pFeature Is Nothing Then<BR>            Debug.Print pFeature.OID<BR>        End If<BR>    Next i<BR>    <BR>End Sub<BR></P>
喜欢0 评分0
游客

返回顶部