'Calculate distance point to line
I'm using Mapbox for Android Java and need to calculate the distance between a drawn line defined by start and endpoint to the users current location.
Any idea on how to implement that with mapbox?
Solution 1:[1]
You have some Turf.js (a geospatial analysis library) methods ported to Android: https://docs.mapbox.com/android/java/guides/turf/
- Use
TurfMisc.nearestPointOnLine()with the line and the user location as an input - Then use
TurfMeasurement.distance()between the two points
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
