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

Add worldCopyJumpCenter option to Map #6723

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

acarapetis
Copy link

Summary:

Adds an option to Map.Drag to make worldCopyJump prefer a central longitude different to 0.

Rationale:

One of the simpler options to handle the issue of longitude wrapping is worldCopyJump, which avoids the need to duplicate or move markers.

For maps concerned principally with the Americas, Europe and the Atlantic between them, it works well: simply place all your markers with longitudes between -180 and 180 as usual, and worldCopyJump will keep things fairly sensible.

Unfortunately, for maps where the region of interest is the Pacific (i.e. crosses the antimeridian), it does not work as well: if we don't want to duplicate layers, we should place our markers in the longitude range [0,360] so that they can all be visible at once; but then worldCopyJump in its current incarnation is no longer useful, since it will jump us over to -180 if we pan too far east.

With this new option set to 180 and markers placed in the [0,360] range, everything works nicely.

@tobske
Copy link

tobske commented Jan 8, 2020

We are using leaflet to draw routes of aircraft and for airlines from east Asia the center of their operation is the pacific.

Copy link
Collaborator

@johnd0e johnd0e left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@Falke-Design Falke-Design left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests are missing. Maybe I find some time in the next weeks to add one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants