C #: distance from a point to a line segment (in longitude and latitude)

I have a position (A) in longitude and latitude.

I have a line segment with start points (B) and end points (C) in longitude and latitude.

What I'm trying to calculate is the shortest distance from A to line B ↔ C. In other words, the distance from A to the nearest point (along the BC line) in meters.

Thanks in advance.

+5
source share
1 answer

I think you could read this link. in order to get the intersection point between A and the perpendicular line to BC passing through A.
Then, using the formulas (and ready-made codes) from here , you can solve your problem.

+3

All Articles