免费视频|新人指南|投诉删帖|广告合作|地信网APP下载

查看: 1485|回复: 0
收起左侧

[软件] ArcGIS计算曲线上任意点到端点的距离

[复制链接]

3

主题

452

铜板

1

好友

助理工程师

Rank: 5Rank: 5

积分
121
发表于 2020-4-24 20:49 | 显示全部楼层 |阅读模式
50铜板
ArcGIS计算曲线上任意点到端点的距离这是在网上找的代码,求助大神解释一下这段代码
Const TOLERANCE As Double = 500
Static pMxDoc As IMxDocument
Static pFtrLyr As IFeatureLayer
Static pFtrCls As IFeatureClass
Static pSpFltr As ISpatialFilter
Static pOutPt As IPoint
Dim pInPt As IPoint
Dim pTopOp As ITopologicalOperator
Dim pFtrCsr As IFeatureCursor
Dim pFtr As IFeature
Dim pPline As IPolyline
Dim dDis As Double
Dim dDummy As Double
Dim bDummy As Boolean
    Set pInPt = [Shape]
    Set pTopOp = pInPt
   
    If pMxDoc Is Nothing Then
        Set pMxDoc = ThisDocument
        Set pFtrLyr = pMxDoc.FocusMap.Layer(1)
        Set pFtrCls = pFtrLyr.FeatureClass
        Set pSpFltr = New SpatialFilter
        pSpFltr.SpatialRel = esriSpatialRelIntersects
        Set pOutPt = New Point
    End If
   
    Set pSpFltr.Geometry = pTopOp.Buffer(TOLERANCE)
    Set pFtrCsr = pFtrLyr.Search(pSpFltr, False)
    Set pFtr = pFtrCsr.NextFeature
    If pFtr Is Nothing Then
        dDis = -1
    Else
        Set pPline = pFtr.Shape
        pPline.QueryPointAndDistance esriNoExtension, pInPt, False, pOutPt, dDis, dDummy, bDummy
    End If
   
    Set pFtrCsr = Nothing
我想要的结果如下图:

代码和图片是网上复制于作者的。


您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

在线客服
快速回复 返回顶部 返回列表