springmeyer / arc.js

great circle routes in javascript
http://springmeyer.github.io/arc.js/
BSD 2-Clause "Simplified" License
369 stars 69 forks source link

Add option for non-breaking lines #13

Closed ccarse closed 2 years ago

ccarse commented 10 years ago

On https://www.mapbox.com/mapbox.js/example/v1.0.0/cross-date-line/ you'll notice the comment:

The coordinate -233.9 is technically invalid but Leaflet permits it because it can imply the direction of wrapping - to wrap in a direction, you can add or subtract 360 from the desired end coordinate

It would be nice if arc.js could generate lines with coordinates like that. If this is something you'd accept in a pull request let me know, I could possibly take a look at it but I can make no promises, my js is very weak.

Thanks, Cody

springmeyer commented 10 years ago

I'm open to wrapping coordinates if that is the right approach for leaflet. /cc @mourner for any thoughts. Currently arc.js by default splits lines that cross the dateline - I presume that wrapping would be an alternative solution?

mourner commented 10 years ago

For use in Leaflet, maybe we could just generate continuous coordinates (including off-range) instead of splitting lines in case either source or destination point is off-range (<-180 or >180)?

springmeyer commented 10 years ago

Thanks @mourner! Sounds like an easier solution and worthwhile. I'll keep the splitting code around for applications like TileMill, but Leaflet is and was the main target of arc.js, so this sounds like a better approach.

mourner commented 10 years ago

Splitting may be useful in Leaflet too, I'm just suggesting an approach that implicitly picks one of the two ways depending on input data, without having to pass an option.

jgravois commented 2 years ago

an implementation of the suggestion in https://github.com/springmeyer/arc.js/issues/13#issuecomment-44318714 would still be welcome, but i'm closing in the name of housekeeping.