Open kylebarron opened 4 years ago
For what it's worth, I found a workaround by using jq
as a filter, i.e. to select only contours at a 50-meter interval at zoom 11 and 20-meter interval at zoom 12:
tippecanoe \
`# Set min zoom to 11` \
-Z11 \
`# Set max zoom to 13` \
-z13 \
`# Read features in parallel; only works with GeoJSONSeq input` \
-P \
`# Keep only the ele_m attribute` \
-y ele_m \
`# Put contours into layer named 'contour_10m'` \
-l contour_10m \
`# Filter contours at different zoom levels` \
-C 'if [[ $1 -le 11 ]]; then jq "if .properties.ele_m % 50 == 0 then . else {} end"; elif [[ $1 -eq 12 ]]; then jq "if .properties.ele_m % 20 == 0 then . else {} end"; else jq "."; fi' \
`# Export to contour_10m.mbtiles` \
-o data/contour_10m.mbtiles \
data/contour_10m/*.geojson
Thanks. Unfortunately what you are running into is that Tippecanoe currently only supports the old expression syntax, not the new full GL style spec expression language. I would like to rectify this someday but unfortunately can't prioritize it at the moment.
Unfamiliar with this older syntax myself I found this somewhat helpful: https://docs.mapbox.com/style-spec/reference/other/#other-filters
to fix my usage essentially replace ["get", "featureProperty"]
with "featureProperty"
It appears that
-j
doesn't work with an expression, but only the deprecated filter syntax, is that true? (Given that the link in the README points to https://docs.mapbox.com/mapbox-gl-js/style-spec/#other-filter, which says that it's deprecated syntax).I'm making vector tiles from contour lines in a newline-delimited GeoJSON file. I'm trying to include only contours that have an elevation that is a multiple of 20, but I'm getting errors of
key is not a string
. Here's a simplified example, with data at the bottom:I believe that this is a valid expression because a simplified style that uses it as a filter passes
gl-style-validate
:tempstyle.json
Example data:
contours.geojson