Distance between points

93 views
Skip to first unread message

szan...@gmail.com

unread,
Apr 6, 2016, 3:41:43 PM4/6/16
to mapsforge-dev
Hi,

I would like to show distance between two point on my map. One is fixed, another one is moving. I don't want a direction, just a straight line between two points.
Calculate distance and draw/redraw a layer which showing a distance? What is the best solution?
Thanks,

Emux

unread,
Apr 6, 2016, 3:56:43 PM4/6/16
to mapsfo...@googlegroups.com
Calculating distances between locations can be done with several algorithms, depending on the accuracy you want.

In release and master branch we provide the Euclidean distance between two locations in degrees using the Pythagorean theorem via LatLong.distance.

In dev branch we provide:
- the Euclidean distance between two locations in degrees using the Pythagorean theorem via LatLongUtils.distance
- the spherical distance between two locations in meters using the Haversine formula via LatLongUtils.sphericalDistance
- the geodetic distance between two locations in meters using the Vincenty inverse formula for ellipsoids via LatLongUtils.vincentyDistance

For all these there is much information available online.


To draw points / lines you can have a look in OverlayMapViewer example in Samples with details for Mapsforge overlay API.

--
Emux

szan...@gmail.com

unread,
Apr 10, 2016, 4:53:35 PM4/10/16
to mapsforge-dev
Thanks
Reply all
Reply to author
Forward
0 new messages