Tippecanoe is the tool I always use for converting Shapefiles/GeoJSONs to Mapbox vector tiles in PBF format, for rendering in Mapbox-GL-JS. But it doesn't seem ideal: its primary use case seems to be processing enormous point datasets such as tweets which means:

  • It focuses on points, not lines or polygons.
  • Many of its settings are focused on determining which features to drop.

There are other limitations in practice:

  • its processing of line and polygon features can be really ugly,
  • its "base zoom" model is not well explained, so that working through its dozens of configuration parameters is pretty hit and miss.
  • although it has some per-feature properties like maxzoom and minzoom it doesn't have a way to vary which properties are included per level
  • its functioning is pretty opaque, there's not much information generated about what choices were made at each level, how "heavy" the tiles are overall, etc.

So my question is: are there other ways to convert vector files to vector tiles that work better for polygons and lines?

  • github.com/mapbox/mapbox-tile-copy is an alternative. I believe that's the exact process that happens when you upload to Mapbox. For a bunch of reasons it's less user friendly than tippecanoe. And you still need to then bundle up your mvt into an mbtiles. – AndrewHarvey Jan 9 at 10:11
  • Also github.com/NYCPlanning/geojson2mvt outputs mvt static files using node. Very simple. Uses geojson-vt. – malcolm Jan 10 at 1:24
  • Huh, that's strange @AndrewHarvey - cutting vectors into tiles and uploading to S3 seem like pretty separate tasks. Wonder which bit does the actual vector tile generation. – Steve Bennett Jan 10 at 1:58
  • Tilelive-omnivore or one of its dependencies maybe... – AndrewHarvey Jan 10 at 11:30
  • How do you store the data? Is PostGIS an option? I am using PostGIS to generate and store tiles in separate table to the table with the geometry. – Dennis Bauszus Apr 24 at 20:24

Tippecanoe is designed for lines and polygons as well. Here's a recommended starting point for representing polygons at all zoom levels, with one property you want to aggregate at low (zoomed-out) levels when features are combined to keep tiles small and visually useful.

tippecanoe -o out.mbtiles -P --coalesce-smallest-as-needed --detect-shared-borders --extend-zooms-if-still-dropping -z12 --accumulate-attribute=my-attribute:sum|max|min|avg mydata.geojson
  • Thanks, I hadn't seen the --accumulate-attribute flag before, interesting. (I'm definitely aware that Tippecanoe supports lines/polygons, but some of that support feels quite bolted on, and the default behaviour is often pretty terrible without a bunch of flags...) – Steve Bennett Apr 25 at 12:57

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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