openstreetmap / openstreetmap-website

The Rails application that powers OpenStreetMap
https://www.openstreetmap.org/
GNU General Public License v2.0
2.15k stars 908 forks source link

Change low zoom projection from Mercator to Globe/Sphere #2604

Closed lectrician1 closed 4 years ago

lectrician1 commented 4 years ago
pnorman commented 4 years ago

I assume you're talking at low-zoom. Does Leaflet support what you want to do?

lectrician1 commented 4 years ago

I assume you're talking at low-zoom. Does Leaflet support what you want to do?

I don't think so. Basically what this guy is asking is what I'd like to see: https://gis.stackexchange.com/questions/279464/leaflet-js-3d-globe-mode-with-terrain

tomhughes commented 4 years ago

So that would be the answer as to why it isn't done then, wouldn't it, because the software we're using doesn't support it...

tomhughes commented 4 years ago

Even if leaflet supported it we would of course also need our tile rendering stack to support it, and ideally the tile rendering stacks of all our tile layers... So it's probably premature to discuss it here.

lectrician1 commented 4 years ago

Yes. This kind of feature does support move to WebGL though.

tomhughes commented 4 years ago

Well maybe, but that's a huge thing, and probably still needs a fallback for browsers that can't handle it.

c933103 commented 4 years ago

It seems meaningless to change it for iD since iD cannot edit at low zoom level anyway?

lectrician1 commented 4 years ago

It seems meaningless to change it for iD since iD cannot edit at low zoom level anyway?

I mean it could be, you would just have to have an algorithm that determines where you want to put nodes, even though the elevation in the editor frame is varied based on curvature of the earth (but barely). Also, having it in iD would also help improve the mapping of northern areas.

gravitystorm commented 4 years ago

So we would need two pre-requisites for this:

Both of these are significant challenges! And neither of them are within the remit of this development team.

So while I support your feature request, until at least the first pre-requisite is solved, there's nothing that can be done here. So as such, I'm going to close this issue.

lectrician1 commented 3 years ago

I should have posted this sooner, but now I'm more educated about how the OSM website works, concerns, etc.

CesiumJS is currently a choice: https://cesium.com/cesiumjs/

Disadvantage: It's not lightweight. However, it does support both 3d and 2d maps, so maybe switching between the two for different platforms might be an option?

Someone more experienced with tile servers should probably look into it.

tomhughes commented 3 years ago

I don't see how using a different library helps if the only tiles we have are mercator.

lectrician1 commented 3 years ago

Cesium supports Merkator tiles I think (specifically from OSM, wow): https://cesium.com/docs/cesiumjs-ref-doc/OpenStreetMapImageryProvider.html

Also, if we wanted to use 3D Tiles (3D buildings yay), here's a renderer I found: https://github.com/Geodan/pg2b3dm

tomhughes commented 3 years ago

Reprojecting mercator tiles onto a globe on the client is hardly an optimal solution though, either in terms of complexity or of the quality of the results. Does it also require webgl to work?

lectrician1 commented 3 years ago

Yes.

CesiumJS is a JavaScript library for creating 3D globes and 2D maps in a web browser without a plugin. It uses WebGL for hardware-accelerated graphics, and is cross-platform, cross-browser, and tuned for dynamic-data visualization.

https://github.com/CesiumGS/cesium

tomhughes commented 3 years ago

Right so that creates a compatibility issue as well in terms of relying on webgl. I've had to disable it on one of my machines for example to stop my browser crashing and I believe support is by no means universal.

lectrician1 commented 3 years ago

Seems pretty well-supported to me: https://caniuse.com/webgl

Not to bring Google back into this, but they use it for both Maps and Earth. One can easily assume it's credible with the number of users they service.

Also, couldn't the website default to Leaflet?

tomhughes commented 3 years ago

That's the high level view but firefox at least has a whole system of blacklisting various combinations of os/graphics card/driver where there are known issues: https://wiki.mozilla.org/Blocklisting/Blocked_Graphics_Drivers

lectrician1 commented 3 years ago

I would agree that this is a concern, but these are drivers from 10 years ago. Those who experience these issues would probably have updated them after experiencing that other commonplace sites that WebGL do not work.

I also did some research and came across this concern:

Unfortunately, hardware vendors stop producing drivers for legacy products (anything released before last Tuesday). In some cases, your PC vendor will insist on releasing their own modified driver updates and there’s no guarantee they’ll do that. Your graphics card may be WebGL-compatible, but it’ll be blocked in Firefox if the driver version is 0.0.0.1 behind the approved list.

From: https://www.sitepoint.com/firefox-enable-webgl-blacklisted-graphics-card/

This reason is also understandable. WebGL is a must-have for graphics drivers currently and this situation only seems to be a problem for older hardware.

For any of these instances, I would argue that leaving Leaflet as a defaultable map and implementing a WebGL Globe would offer much more benefits than concerns.

lectrician1 commented 3 years ago

Also, here's a demo: https://sandcastle.cesium.com/#c=bZBhb9owEIb/SpQvAYk6hamTWigaiyoWlpACKYwqX0xyTUxsJ9hOIFT97zOwaV23+3Z3z/tIdw5IUjHkFhwl8IIrqkZxDFKGRQ7cuDcsaCbZZhyTgEzcp6PbnRJXunx+EzvuZzcvfyydyS3S0C4Z5xrSAHtqpqHbW5Prm2A1a7xwdghWvlqHUxYsumzae+itw2Xmr+a55ojnTMpnLfOP6Sd/60uX0Sw59eF6P93G3SCMuz6/RjW7SuezWzZabeTucLUd7yaP7LsMv3nPoaizr3nyMPL2EoK9b/UjXmNh1AT2IPQVHPaGc7l0eZ61rPjcOgVXmHAQVsd4jbihizCcgmgeRVGTRKfv3qeDEvhCCQDl49L9m2z9EpyK4QNhFfOgBqoNvc6fVSVOEytTqpR3to2RIhRQocXyLGa4RIVIrUvirR3xt3bf7JgDqRoKw9+iL4SVhVAnXQshWwErKVYg7U0V56BQLGW7f4EH9vvoICG1QZL7yPzwgsg0Yoql1JuXitIFOUJkDge25v+J0gInhKdBDYLi5oRl3aF3GSKEBrZu/59URUE3WHww/wQ

(max zoom level set to 3)

GoodClover commented 3 years ago

Reading through this I see you are suggesting using merkator tiles on a globe, the whole point of merkator is that it is flat and this wouldn't work too well.

Making a 3D globe to me would be something done with vector tiles, after those have become available.

lectrician1 commented 3 years ago

Reading through this I see you are suggesting using merkator tiles on a globe, the whole point of merkator is that it is flat and this wouldn't work too well.

But it does work currently, which is honestly great. Also, if we were to use Leaflet as a fallback, merkator tiles would still have to be generated.

Making a 3D globe to me would be something done with vector tiles, after those have become available.

I love vector tiles too. I suggested using 3DTiles (Standard: https://www.ogc.org/standards/3DTiles Possible Renderer: https://github.com/Geodan/pg2b3dm ) for the globe as well.

I'm not sure how hard implementing 3DTiles would be though (API supports lad/long but not height, idk what osm-carto would do, you'd probably need to look more into the renderer).

simonpoole commented 3 years ago

@lectrician1 given that setting up a dev/demo instance of the OSM website is rather easy. I don't quite see why you haven't at least provided a proof of concept for this idea, it definitely would increase the chances of this being implemented down the road.

GoodClover commented 3 years ago

@lectrician1 I wasn't suggesting we stop Merkator all together, raster tiles are still the de-facto and everything supports them. Just that having vector tiles would be nice, whether raster or vector is used would depend on the style layer selected.

The benefit of vector is that the style isn't tile dependent and for a 3D globe no data is lost around the equator, with Merkator being un-projected it would be lost (low quality, the poles would also be glitchy with squashed up tiles).

3d view should be a togglable option, preferably off by default

tomhughes commented 3 years ago

Yes we all want vector tiles. Except that apparently nobody wants them enough to actually do the necessary work.

erik55 commented 3 years ago

Here maps (Nokia?) has a globe since at least 6 years in the web browser.

And Magic Earth app (uses OSM data) is another example using a sphere – and vector tiles. The projection changes from sphere to Mercator are a bit abrupt, though.

dieterdreist commented 3 years ago

sent from a phone

On 10 Mar 2021, at 09:27, ☠☠☠ notifications@github.com wrote:

  • The only other OSM-related application that even proposed this was [OSMAnd]

Apple maps also uses a globe in 3D map view