maplibre-gl-js icon indicating copy to clipboard operation
maplibre-gl-js copied to clipboard

Globe view - Earth is not flat

Open Gustavo22Soaresh opened this issue 3 years ago • 21 comments

Motivation

Hello, I think it would be interesting when zooming out instead of duplicating the merchant projection it would be nice to show the view of the entire globe, similar to google earth and the new Apple Maps

Design Alternatives

i-OS-15-Maps-Feature.jpg globe-view.png

Design

Mock-Up

Concepts

Implementation

Gustavo22Soaresh avatar Sep 04 '21 12:09 Gustavo22Soaresh

I think this would be great, but I don't have the slightest clue how to implement this. Your best approach would be to submit a PR after implementing this. I also think this should be configurable for people that wouldn't want this... Also there's a need to make sure this does not cause performance issues in terms of fetching too many tiles... But, sure, this feature would be very nice to have :-)

HarelM avatar Sep 04 '21 12:09 HarelM

Happy to review pull requests on this too. Here is a link that @klokan gave me:

https://observablehq.com/@fil/webmercator-to-globe?collection=@fil/glsl-projections

wipfli avatar Sep 04 '21 12:09 wipfli

I'm not sure if/how relevant this MapBox GL JS issue is: https://github.com/mapbox/mapbox-gl-js/issues/10784, perhaps informative if anything?

Malvoz avatar Sep 05 '21 17:09 Malvoz

Well, looks like someone from mapbox is coding it so we can't use it due to licencing issues. By the amount of corner cases that this thread is talking about it seems like a huge effort, but if you are up for the challenge, why not? :-)

HarelM avatar Sep 05 '21 17:09 HarelM

@Malvoz thanks for posting the related Mapbox link here. If someone is going to implement this feature in MapLibre GL JS you could maybe act as a referee who makes sure that we don't copy-paste their proprietory code.

wipfli avatar Sep 06 '21 16:09 wipfli

I suspect this would be a pretty large work effort to achieve and would only be good for a small subset of business scenarios. This would not be good for data visualizations where users are looking to get business insights most of the time as they will need to see all the data.

rbrundritt avatar Sep 17 '21 15:09 rbrundritt

This can be an opt-in. I don't see a problem in theory if someone world like to do this.

HarelM avatar Sep 17 '21 15:09 HarelM

My main concern would be how much this feature would in flat the project. If it grows the code base by 10% for something that would be use 5% of the time, should this be out of the box, or is there a modular approach that could be implemented?

rbrundritt avatar Sep 17 '21 15:09 rbrundritt

Let's have this discussion if someone decides to implement this, this is currently not the case as far as I know...

HarelM avatar Sep 17 '21 16:09 HarelM

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 30 days.

github-actions[bot] avatar Mar 17 '22 01:03 github-actions[bot]

The title sounds so self-righteous, like the author knows everything! What if it is? :earth_africa: -- it could be flat if you look from its side :)

nyurik avatar Mar 17 '22 02:03 nyurik

Has there been any movement on this?

alienatorZ avatar May 04 '22 20:05 alienatorZ

Not that I know...

wipfli avatar May 04 '22 20:05 wipfli

Would it be nice for you to have?

wipfli avatar May 04 '22 20:05 wipfli

Would be nice to have the discussion and steps to take.

am2222 avatar May 11 '22 02:05 am2222

Anybody keen in jumping on implementation of the "Adaptive Composite Map Projection" (google this)?

It is the math. R&D done 10 years ago. Going from Orthographic projection of the globe to the Mercator as you zoom in. This is what Google Maps implemented - and now Mapbox too - on the upper zoom levels.

https://berniejenny.info/demos/AdaptiveCompositeMapProjections/ https://github.com/OSUCartography/adaptive-composite-map-projections

If you want it to be done - send a vote to https://roadmap.maplibre.org/ on it :-)

klokan avatar May 11 '22 16:05 klokan

Might be related to #168 I guess...

HarelM avatar Aug 17 '22 12:08 HarelM

I think the easies way to implement globe-view would be to:

  • reuse terrain render-to-texture logic to create raster-tiles for the current style
  • create a new shader for globe view, which projects tile-coordinates from the terrain-mesh to a sphere via:
    • project to epsg4326 (= degrees)
    • and then with sin/cos to a sphere
    • fill the poles with trianles from terrain-mesh to the poles
  • paint the raster-tiles to the sphere terrain-mesh

This approach has nothing to do with other projections like albert or so, but may this can be done in a similar way?

prozessor13 avatar May 15 '23 12:05 prozessor13

Interesting @prozessor13. Would that also handle labels?

wipfli avatar May 15 '23 13:05 wipfli

No, label position/placement must be calculated in CPU, but in the same way. Coordinate picking in the map on the other hand should be not too complicated, because of the coords-framebuffer, which holds all coordinates in a hidden gpu-framebuffer, which should be working in every projection.

prozessor13 avatar May 15 '23 14:05 prozessor13

expect

tangzijun avatar Dec 25 '23 14:12 tangzijun