Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

destination and rhumbDestination resulting in wrong distance when closer to the North/South deviation angle is applied #1732

Closed
jcimoch opened this issue Jul 16, 2019 · 3 comments

Comments

@jcimoch
Copy link

jcimoch commented Jul 16, 2019

When you look at example below you can see 3 points.
Two of them are in about 100 miles distance on the same latitude.
One of them is supposed to be 100miles away to the North direction (90 degrees), but clearly it's not 100miles, more like 10000miles.

Why is this happening? Is it a bug or I don't understand something?
I know that in Mercator projection we have the same distance but not angles, however I don't see corelation in calculations here to the projection issue (nevertheles this issue #684 seems to touch similar problem)
Screenshot 2019-07-16 at 16 59 47

Code example reproducing the problem HERE

@dpmcmlxxvi
Copy link
Collaborator

dpmcmlxxvi commented Jul 16, 2019

@jcimoch Doesn't look like a bug. Leaflet expects coordinates in order (latitude, longitude) but Turf expects them in the order (longitude, latitude). Just reverse them before using in Turf and then reverse them back when using the result in Leaflet.

@stebogit
Copy link
Collaborator

@jcimoch I believe this is due to the distortion of the Mercator projection. Rhumb functions move along straight lines, so the issue is emphasised.

@jcimoch
Copy link
Author

jcimoch commented Jul 16, 2019

@dpmcmlxxvi good catch! indeed it's argument (lat/lon) order. I was reversing it however forgot to also revers the output back ... thanks a lot!!

here is solution
http://jsfiddle.net/3x7548Lm/

I'm closing the topic.

@jcimoch jcimoch closed this as completed Jul 16, 2019
@jcimoch jcimoch changed the title destination and rhumbDestination resulting in wrong distnace the closer to the North/South deviation angle applied destination and rhumbDestination resulting in wrong distance the closer to the North/South deviation angle applied Jul 16, 2019
@jcimoch jcimoch changed the title destination and rhumbDestination resulting in wrong distance the closer to the North/South deviation angle applied destination and rhumbDestination resulting in wrong distance when closer to the North/South deviation angle is applied Jul 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants