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

Globe view map style is inconsistent with latitude #5471

Open
tsupinie opened this issue Feb 6, 2025 · 5 comments
Open

Globe view map style is inconsistent with latitude #5471

tsupinie opened this issue Feb 6, 2025 · 5 comments
Labels
need more info Further information is requested

Comments

@tsupinie
Copy link

tsupinie commented Feb 6, 2025

maplibre-gl-js version: 5.1.0

browser: Firefox, Chrome, Safari

Link to Demonstration

It's visible in the globe view custom layer demo.

At low latitudes, the country labels are visible.
Image

At higher latitudes, the country labels disappear.
Image

At even higher latitudes, the "Arctic Circle" label disappears, too.
Image

Expected/actual behavior

My expectation is that the map style should remain consistent across latitude when the globe is the same size in the window. (I know I'm probably using the term "map style" incorrectly, I can't think of a better way to say it right now.)

This appears to be related to the map zoom factor changing across latitude. Based on this comment

    // To stay consistent with web mercator maps, globe is automatically enlarged when map center is nearing the poles.
    // This keeps the map center visually similar to a mercator map with the same x,y and zoom.

(here), I'm inferring that panning northward moves the camera in the +y direction, and the globe enlarges to keep the apparent size the same. But it seems like that results in the zoom factor changing with latitude because the camera is farther from the Earth center.

So there's a lot of guesswork in there, and I'm not sure if any of it's right. But that's some behavior in the map style that is (to me) unexpected. (Hopefully, this isn't a duplicate report. I scanned through the open issues, and I didn't see anything that looked promising. But maybe #5439 is related.)

@zerda-ocm
Copy link

It is related to #5436

Demo with your expected behaviour as a proof of concept:
https://jsbin.com/piwekap/edit?html,output

@tsupinie
Copy link
Author

tsupinie commented Feb 6, 2025

That link actually displays my expected behavior with no modification needed. I'm not sure what's different between that and the example in the documentation (or the code version on unpkg, which is what I'm using in the testing application where this came up originally).

@zerda-ocm
Copy link

The modification is a custom build with a change to the maplibre source code and is not production ready because of some bugs around the level 12 zoom.

Feel free to look at the changes I made: https://github.com/zerda-ocm/maplibre-gl-js/tree/constant_zoom

@tsupinie
Copy link
Author

tsupinie commented Feb 6, 2025

Ah, okay, reading is not my strong suit, haha. Thanks for chiming in! I'd be interested to see that make it into the main library once you get the bugs worked out.

@HarelM
Copy link
Collaborator

HarelM commented Feb 7, 2025

This is explained here:
https://github.com/maplibre/maplibre-gl-js/blob/main/developer-guides/globe.md

While I agree it's not ideal, there are reasons for this...

@HarelM HarelM added the need more info Further information is requested label Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need more info Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants