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

Investigate Leaflet.Geodesic to handle antimeridian wrapping issue #75

Open
darksidelemm opened this issue Mar 25, 2023 · 6 comments
Open

Comments

@darksidelemm
Copy link
Member

This might be an option: https://github.com/henrythasler/Leaflet.Geodesic

The GeodesicCircle part of this might also be useful for range rings.

@darksidelemm
Copy link
Member Author

darksidelemm commented Mar 26, 2023

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:
Screen Shot 2023-03-26 at 10 32 20

It looks like the polyline continues off to the right of the screen, but cannot be viewed.

@darksidelemm
Copy link
Member Author

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.

@darksidelemm
Copy link
Member Author

Thoughts on next steps for this...

  • Identify where in tracker.js a balloon path is generated, added to, and removed.
  • Abstract all additions to the path into a function, to make experimenting with various approaches easier.
  • Same for removing of the path (since we may need to remove multiple path snow)
  • As an initial stab, try making a duplicate of the path at +/- 360 degrees longitude, and see how that looks.

@darksidelemm
Copy link
Member Author

darksidelemm commented Jun 3, 2023

@darksidelemm
Copy link
Member Author

This is the result of naively adding in additional polylines at +/- 360 degrees:

Screen Shot 2023-06-04 at 09 43 09

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?

@darksidelemm
Copy link
Member Author

darksidelemm commented Jun 4, 2023

Switching to Leaflet.Geodesic gets us closer (VE3OCL-34, 1 month history):
Screen Shot 2023-06-04 at 10 02 32

Unfortunately things still break if the polyline wraps the antimeridian more than once (in this case VE3OCL-34, with 6 months history):
Screen Shot 2023-06-04 at 10 04 20

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:
Screen Shot 2023-06-04 at 10 14 08

Anyway, the current state of this is in https://github.com/darksidelemm/sondehub-amateur-tracker/tree/antimeridian

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

1 participant