简体   繁体   English

c#:从点到线段的距离(经度和纬度)

[英]c#: Distance from point to a line segment (in longitude and latitude)

I have a position (A) in longitude and latitude. 我在经度和纬度上有一个位置(A)。

I have a line segment with start (B) and end (C) points in longitude and latitude. 我有一个带有经度和纬度的起点(B)和终点(C)点的线段。

What I am trying to calculate is the shortest distance from A to line B<->C. 我想要计算的是从A到B < - > C的最短距离。 In other words the distance from A to the closest point (on line BC) in meters. 换句话说,从A到最近点(在线BC上)的距离,以米为单位。

Thanks in advance. 提前致谢。

I think you could read this link to get the intersection point between A and the perpendicular line to BC passing on A. 我想你可以阅读这个链接来获得A和BC的垂直线之间的交点。
Then using formulas (and code ready) from here you should be able to solve your problem. 然后从这里使用公式(和代码就绪)你应该能够解决你的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM