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.12k stars 614 forks source link

Unknown expression "pitch" in layers filter #1272

Open homa-varamin opened 3 weeks ago

homa-varamin commented 3 weeks ago

I created a new style using mapbox studio. After Importing mapbox style.json to tileserver-gl styles, and when i start the server i get this error:

[Unknown expression "pitch"](undefined: layers[35].filter[4][1][0]: Unknown expression "pitch". If you wanted a literal array, use ["literal", [...]].)

I noticed that server cannot pars the filter of mapbox in some layers. the layer with problem is:

{ "id": "tunnel-oneway-arrow-white", "type": "symbol", "metadata": { "mapbox:featureComponent": "road-network", "mapbox:group": "Road network, tunnels" }, "source": "composite", "source-layer": "road", "minzoom": 16, "filter": [ "all", ["==", ["get", "structure"], "tunnel"], [ "match", ["get", "class"], ["motorway", "motorway_link", "trunk", "trunk_link"], true, false ], ["==", ["get", "oneway"], "true"], [ "step", ["pitch"], true, 50, ["<", ["distance-from-center"], 1], 60, ["<", ["distance-from-center"], 1.5], 70, ["<", ["distance-from-center"], 2] ] ], "layout": { "symbol-placement": "line", "icon-image": [ "step", ["zoom"], "oneway-white-small", 18, "oneway-white-large" ], "symbol-spacing": 200, "icon-rotation-alignment": "map", "icon-allow-overlap": true, "icon-ignore-placement": true }, "paint": {} }

when I remove the ["pitch"] fitler from the style.json, server error get vanish. If I can help in any part of this problem and create pull request, please tell me. Thank you very much

acalcutt commented 3 weeks ago

TileServer-GL now uses the maplibre-style-spec and MapLibre js / native. MapLibre was forked from the open source mapbox 1.x , so support to current mapbox 2.x+ spec is not 100% since they have been on diverged paths for several years since mapbox went closed source.

For TileServer-GL and MapLibre, you might want to try maputnik https://maplibre.org/maputnik/

My guess is the pitch expression was added to mapbox after the fork, so it likely isn't supported. For example, I saw this discussion recently ( https://github.com/maplibre/maplibre-gl-js/discussions/4207 )

homa-varamin commented 3 weeks ago

I don’t know how to thank you, acalcutt 🙏🙏🙏

homa-varamin commented 3 weeks ago

I found another online map style editor. It has more modern look than maplibre maputnik and can save your map style in your online profile.

https://cloud.maptiler.com/maps/editor

pm0u commented 2 weeks ago

Edit: Going to move this to maplibre, landed here searching and realize this is better suited there.