1

I use tippocanoe to build Mapbox Vector Tiles from GEOJSON features but can't get the filter to work.

I use a geojson file which contains millions of features and want to filter them for different zoom levels using property "ZOOM".

My geojson file looks like that:

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {
        "OBJECTID": "2580023",
        "ZOOM": 2
      },
      "geometry": {
        "type": "MultiLineString",
        "coordinates": [
          [
            [
              -95.847916666999936,
              41.16875
            ],
            ...
          ]
        ]
      }
    },
    ...
  ]
}

I try to use this tippocanoe command but resulting vector tiles contain all the features and not just the once where "ZOOM"<3:

tippecanoe --no-tile-size-limit --feature-filter='{"features": ["<", "ZOOM", 3]}' -Z3 -z3 -o output.mbtiles input.geojson

Something is wrong in the --filter-feature attributes. Actually I suspect that "features" is not ok but I don't know what to put there. But the filter itself should be like that as described in Mapbox GL Style Specification.

1

Just found out that the first attribute in the filter has to be the layer name where it should get applied to.

If you don't define any layer name, the filename without the dot is used as layer name. So for example, if your file is called input.geojson, this command works:

tippecanoe --no-tile-size-limit --feature-filter='{"inputgeojson": ["<", "ZOOM", 3]}' -Z3 -z3 -o output.mbtiles input.geojson

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.