在KML多边形上查找最近的点

问题描述 投票:0回答:1

在图中:

  • 红色是GEO点(来自GEO位置)
  • 蓝色是KML多边形
  • 绿色是半径来检查最近的点
  • 棕色点是半径内KML上的最近点

如何在数学上找到这些最近的点?

Graphic

algorithm geometry kml
1个回答
1
投票
result = an empty list of points

for each edge of the KML polygon:
    if the edge is completely inside the green circle:
        append to result the point on the edge that is closest to the green circle center (see https://math.stackexchange.com/questions/2193720/find-a-point-on-a-line-segment-which-is-the-closest-to-other-point-not-on-the-li) 
    else:
        if the edge has two different intersections with the green circle:
            find the two intersection P1 and P2
            append to result the point (P1+P2)/2
        else:
            if the edge has one intersection with the green circle:
                append to result the intersection
            endif
        endif
    endif
endfor
© www.soinside.com 2019 - 2024. All rights reserved.