Open darksidelemm opened 1 year ago
Some quick investigations suggest this might work with the wrap:false option when creating the polyline (now L.Geodesic instead of L.Wrapped.PolyLine)
To test this, replace all instances of L.Wrapped.PolyLine with L.Geodesic, then also replace instances of L.Geodesic(point with L.Geodesic([point] to get rid of some typing errors.
However, there is some weird behaviour with long polylines in this case, e.g. in this example:
It looks like the polyline continues off to the right of the screen, but cannot be viewed.
It looks like the only way to handle this properly is going to be to make duplicate copies of the polyline shifted by multiples (up to some limit based on when worldCopyJump kicks in) of 360 degrees... Urgh.
Thoughts on next steps for this...
New car vehicle polyline created here: https://github.com/projecthorus/sondehub-amateur-tracker/blob/main/js/tracker.js#L2452
New balloon vehicle polyline created here: https://github.com/projecthorus/sondehub-amateur-tracker/blob/main/js/tracker.js#L2674
Vehicle info object created here: https://github.com/projecthorus/sondehub-amateur-tracker/blob/main/js/tracker.js#L2718
Nyancat version here: https://github.com/projecthorus/sondehub-amateur-tracker/blob/main/js/tracker.js#L2775
Polyline positions updated here: https://github.com/projecthorus/sondehub-amateur-tracker/blob/main/js/tracker.js#L2811
Removal of polylines: https://github.com/projecthorus/sondehub-amateur-tracker/blob/main/js/tracker.js#L2811
This is the result of naively adding in additional polylines at +/- 360 degrees:
Almost works, but we get the issue where the track crosses the antimeridian and the polyline wraps back to the left. Maybe this approach combined with Geodesic will resolve that?
Switching to Leaflet.Geodesic gets us closer (VE3OCL-34, 1 month history):
Unfortunately things still break if the polyline wraps the antimeridian more than once (in this case VE3OCL-34, with 6 months history):
To handle this, I think the code need to determine how many crossings the path takes over the antimeridian, and add additional polyline copies. e.g. one pass = copies at +/- 360 degrees of longitude, 2 passes = copies at +/- 720 degrees of longitude. So I need to figure out how to track this.
Also... the creation of the duplicate polylines really needs to be conditional on the payload path crossing the antimeridian in the first place, else you end up with 'confetti' on the map, like this:
Anyway, the current state of this is in https://github.com/darksidelemm/sondehub-amateur-tracker/tree/antimeridian
This might be an option: https://github.com/henrythasler/Leaflet.Geodesic
The GeodesicCircle part of this might also be useful for range rings.