I want to calculate the perpendicular distance between line and a point. LinePointA(latitude,longitude)-(48.294483,11.568453) LinePointB(latitude,longitude)-(48.283479,11.838929) PointC(latitude,longitude)-(48.561846,11.733314) Here AB is the line and C is the point. Expected distance as per google maps is 59.36 km Thanks in advance.
Asked
Active
Viewed 545 times
-1
-
The answer is entirely dependent on whether you will only be considering lines and points close enough to be considered flat, or whether it needs to work for any set of valid global coordinates? – Phil H Oct 24 '18 at 08:22
-
Yes. Need to work with valid global coordinates. – Nikhil Vernekar Oct 24 '18 at 08:40
1 Answers
0
You can try barefoot -- open source Java library for geometric operation with Earth coordinates.
Here is a solution for your problem -- https://github.com/bmwcarit/barefoot#spatial-search-and-operations
If you want to dive deeper and understand math, look this

Kirill Liubun
- 1,965
- 1
- 17
- 35
-
I tried adding barefoot to maven
com.bmw-carit barefoot 0.1.1 -
1Did you add http://nexus.onebusaway.org/nexus/content/repositories/public/ repository to pom? – Kirill Liubun Nov 05 '18 at 11:49
-
I did not do that. And it worked after adding it. Thank you @Kirill Liubun – Nikhil Vernekar Nov 06 '18 at 06:13