Closed pakro closed 6 years ago
@pakro @turf/destination
calculates distances on a spheroidal Earth, as you were to cover the distance by foot. Leaflet.circle
, as well as @tirf/circle
, draw the circle considering the Earth flat, whilst of course it is not. At large distances, like in your case, the difference becomes evident.
I believe this example should clarify what's going on:
The circle lays on the W
plain, i.e. the radius is W/2
, while the (Turf) distance between A
and B
(the circle's center and the second point you are trying to set on the circumference) is calculated on the arc segment between the two.
Now, to my knowledge Turf does not have a way to calculate the distance on the Map plain (Mercator projection), but it could be useful to have one for this cases.
@stebogit Thanks you very for the clarification. That explains it. I didn't know Leaflet is calculating the distance based on a "flat" earth. I think it would be really helpful if turf can add the same calculation because all online map providers are using the Mercator projection.
I do support the idea of a new module (or set of modules) for euclidean calculations. @pakro see #1017, it might be helpful for your calculations in the meantime.
Hi,
I want to place a marker at the "rightmost aka east" edge of the circle. For that tried to use turf.destination.
The results can be seen in the following fiddle: http://jsfiddle.net/ytnhg16o/
Either leaflet or turf are getting something wrong because the marker should be placed on top of the circle. Since we have a working implementation without using turf but Leaflet I suspect there is an issue within turf.
Any ideas?
Kind regards, Paul