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

Unknown expression "pitch" in layers filter #1272

Open
homa-varamin opened this issue Jun 8, 2024 · 4 comments
Open

Unknown expression "pitch" in layers filter #1272

homa-varamin opened this issue Jun 8, 2024 · 4 comments

Comments

@homa-varamin
Copy link

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
Copy link
Collaborator

acalcutt commented Jun 8, 2024

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 ( maplibre/maplibre-gl-js#4207 )

@homa-varamin
Copy link
Author

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

@homa-varamin
Copy link
Author

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
Copy link

pm0u commented Jun 17, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants