• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录

gisoracle

  • 博客园
  • 联系
  • 订阅
  • 管理

公告

View Post

ArcGIS Pro NearestVertex和NearestPoint

ArcGIS Pro NearestVertex和NearestPoint
   SpatialReference sr = SpatialReferences.WGS84;
            MapPoint pt = MapPointBuilder.CreateMapPoint(10, -4.1, sr);

            List<Coordinate2D> coords = new List<Coordinate2D>()
            {
              new Coordinate2D(10, 1),
               new Coordinate2D(10, -4),
               new Coordinate2D(0, -4),
               new Coordinate2D(0, 1),
                 new Coordinate2D(10, 1)
            };

            Polygon polygon = PolygonBuilder.CreatePolygon(coords, sr);

            // find the nearest point in the polygon geomtry to the pt
            ProximityResult result = GeometryEngine.Instance.NearestPoint(polygon, pt);
            // result.Point = 5, 1
            // result.SegmentIndex = 3
            // result.PartIndex = 0
            // result.PointIndex = null
            //result.Distance = 4
            //result.RightSide = false

            // find the nearest vertex in the polgyon geometry to the pt
            result = GeometryEngine.Instance.NearestVertex(polygon, pt);
            // result.Point = 10, 1
            // result.PointIndex = 0
            // result.SegmentIndex = null
            // result.PartIndex = 0
            // result.Distance = Math.Sqrt(41)
            // result.RightSide = false

 

posted on 2020-03-26 10:06  gisai  阅读(374)  评论(0)    收藏  举报

刷新页面返回顶部
 
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3