maptiler / tileserver-gl

Vector and raster maps with GL styles. Server side rendering by MapLibre GL Native. Map tile server for MapLibre GL JS, Android, iOS, Leaflet, OpenLayers, GIS via WMTS, etc.
https://tileserver.readthedocs.io/en/latest/
Other
2.23k stars 638 forks source link

3D view in maplibre #758

Closed utagawal closed 1 year ago

utagawal commented 1 year ago

In the native viewer of Tileserver-GL (the index page) would it be possible to have 3D view if the sources contains terrain-rgb DEM data ?

acalcutt commented 1 year ago

Right now, you could add a terrain layer into your style, like https://github.com/maplibre/demotiles/blob/gh-pages/styles/osm-bright-gl-terrain/style.json#L5224-L5227

I thought in the past about having a toggle button if a raster-dem existed in sources, but you would have to know the name of the layer. maybe in javascript we could iterate though raster-dem sources and make a button for each of them.

utagawal commented 1 year ago

@acalcutt as always many thanks for the quick reply. We already have the terrain source in our style hence the request.

If we are using the Terrain entry in our json like this : "terrain": { "source": "TerrainSource", "exaggeration": 1 }

Would it be possible for the maplibre viewer embedded in tileserver-gl to detect it and enable the 3D view ?

acalcutt commented 1 year ago

I'm not talking about a terrain source, but a terrain layer (like at the very end of the file I linked). It lets maplibre-gl-js to show the terrain.

acalcutt commented 1 year ago

nevermind, it looks like you already have it. Are you talking about vector viewer or raster? vector/view pages should show terrain. raster/rendered pages can not because maplibre-native does not yet support 3d terrain.

acalcutt commented 1 year ago

Take this as an example ( https://tiles.wifidb.net/styles/WDB_ATV/#12.33/46.11406/8.27133/-24/58 )

With the terrain source and layer, terrain does show in viewer.

utagawal commented 1 year ago

Not successful so far with that : https://maps.utagawavtt.com/styles/utagawavtt/style.json Any idea ?

acalcutt commented 1 year ago

I don't see the terrain layer I mentioned in your style. I do see a 'world-rgb-png' source, but its not used for terrain.

acalcutt commented 1 year ago

Your style is confusing to me. how come you link to other rendered styles as sources?

acalcutt commented 1 year ago

Do you have an actual terrainrgb/terrarium raster-dem somewhere?

utagawal commented 1 year ago

Made it working (issue was the style was not refreshed as expected du to the recent implementation of nginx cache).

However I see the 3D camera pitch is kind of limited (also in your example), any reason why ?

acalcutt commented 1 year ago

Do you mean the 60 degree pitch limit? it is a maplibre-gl-js default, we would have to change the view template so it sets the 'maxPitch' map option

options.maxPitch default: 60 | The maximum pitch of the map (0-85). Values greater than 60 degrees are experimental and may result in rendering issues. If you encounter any, please raise an issue with details in the MapLibre project. -- | --

In my own maps I usually set maxPitch to 85, like in https://wifidb.net/wifidb/opt/map.php?func=wifidbmap&labeled=0

utagawal commented 1 year ago

Do you mean the 60 degree pitch limit? Exactly

we would have to change the view template so it sets the 'maxPitch' [map option](https://maplibre.org/maplibre-gl-js-docs/api/map/) Any possibility to have this option ? 60° is very restrictive.

acalcutt commented 1 year ago

I don't think it is a good idea until maplibre-gl-js 3.0 is released which has perfomance updates for terrain. The extra angle makes the map have to load a lot more, so this performance is important. Right now above 60deg is considered experimental.

Also, I think it would be nice if sky was implemented first, which I think also may end up a 3.0 thing.

utagawal commented 1 year ago

Maplibre 3.0 has been released ! :-)