Build vector tilesets from large collections of GeoJSON features.
Go to file
2015-03-25 13:54:29 -07:00
clip.c Clip large LineString features down to the bounds of the tile 2014-09-26 17:07:52 -07:00
clip.h Clipping code from datamaps 2014-09-26 16:35:18 -07:00
decode.cc Fix operator precedence warning 2014-11-14 15:26:59 -08:00
enumerate.c Trying to follow Vlad's suggestion and work from the top down. 2014-12-03 16:18:43 -08:00
geojson.c Merge remote-tracking branch 'origin/master' into multilayer 2015-03-25 13:54:29 -07:00
geometry.cc Use bounding box for quick accept/reject before detailed clipping. 2014-12-11 13:34:50 -08:00
geometry.hh Use bounding box for quick accept/reject before detailed clipping. 2014-12-11 13:34:50 -08:00
jsonpull.c Sprinkle consts and casts to make it valid C++ as well as C 2014-12-02 14:17:49 -08:00
jsonpull.h Sprinkle consts and casts to make it valid C++ as well as C 2014-12-02 14:17:49 -08:00
LICENSE.md Add license 2014-02-08 10:33:57 -08:00
Makefile Make the bin directory on install if it doesn't already exist 2014-12-02 11:38:48 -08:00
mbtiles.c Multiple layers make it into JSON metadata now 2015-03-24 16:28:31 -07:00
mbtiles.h Multiple layers make it into JSON metadata now 2015-03-24 16:28:31 -07:00
pool.c Just use a standard C++ type for deduplicating instead of reinventing the wheel 2014-10-31 16:50:28 -07:00
pool.h Just use a standard C++ type for deduplicating instead of reinventing the wheel 2014-10-31 16:50:28 -07:00
projection.c Move projection and tile arithmetic to its own file 2014-10-24 17:22:14 -07:00
projection.h Move projection and tile arithmetic to its own file 2014-10-24 17:22:14 -07:00
README.md Clean up the gamma semantics a little. 2015-03-23 14:44:21 -07:00
tile.cc Merge remote-tracking branch 'origin/master' into multilayer 2015-03-25 13:54:29 -07:00
tile.h Write out geometries for all layers 2015-03-24 17:07:51 -07:00
vector_tile.proto Add vector tile boilerplate 2014-09-22 10:45:34 -07:00

tippecanoe

Builds vector tilesets from large collections of GeoJSON features.

Intent

The goal of Tippecanoe is to enable making a scale-independent view of your data, so that at any level from the entire world to a single building, you can see the density and texture of the data rather than a simplification from dropping supposedly unimportant features or clustering or aggregating them.

If you give it all of OpenStreetMap and zoom out, it should give you back something that looks like "All Streets" rather than something that looks like an Interstate road atlas.

If you give it all the building footprints in Los Angeles and zoom out far enough that most individual buildings are no longer discernable, you should still be able to see the extent and variety of development in every neighborhood, not just the largest downtown buildings.

If you give it a collection of years of tweet locations, you should be able to see the shape and relative popularity of every point of interest and every significant travel corridor.

Installation

The easiest way to install tippecanoe on OSX is with Homebrew:

brew install tippecanoe

Usage

tippecanoe -o file.mbtiles [file.json]

If the file is not specified, it reads GeoJSON from the standard input.

The GeoJSON features need not be wrapped in a FeatureCollection. You can concatenate multiple GeoJSON features or files together, and it will parse out the features and ignore whatever other objects it encounters.

Options

  • -l name: Layer name (default "file" if source is file.json)
  • -n name: Human-readable name (default file.json)
  • -z zoom: Base (maxzoom) zoom level (default 14)
  • -Z zoom: Lowest (minzoom) zoom level (default 0)
  • -d detail: Detail at base zoom level (default 26-basezoom, ~0.5m, for tile resolution of 4096 if -z14)
  • -D detail: Detail at lower zoom levels (default 10, for tile resolution of 1024)
  • -x name: Exclude the named properties from all features
  • -y name: Include the named properties in all features, excluding all those not explicitly named
  • -X: Exclude all properties and encode only geometries
  • -f: Delete the mbtiles file if it already exists instead of giving an error
  • -r rate: Rate at which dots are dropped at lower zoom levels (default 2.5)
  • -b pixels: Buffer size where features are duplicated from adjacent tiles (default 5)
  • -g gamma: Rate at which especially dense dots are dropped (default 0, for no effect). A gamma of 2 reduces the number of dots less than a pixel apart to the square root of their original number.

Example

tippecanoe -o alameda.mbtiles -l alameda -n "Alameda County from TIGER" -z13 tl_2014_06001_roads.json

cat tiger/tl_2014_*_roads.json | tippecanoe -o tiger.mbtiles -l roads -n "All TIGER roads, one zoom" -z12 -Z12 -d14 -x LINEARID -x RTTYP

Geometric simplifications

At every zoom level, line and polygon features are subjected to Douglas-Peucker simplification to the resolution of the tile.

For point features, it drops 1/2.5 of the dots for each zoom level above the base. I don't know why 2.5 is the appropriate number, but the densities of many different data sets fall off at about this same rate. You can use -r to specify a different rate.

You can use the gamma option to thin out especially dense clusters of points. For any area that where dots are closer than one pixel together (at whatever zoom level), a gamma of 3, for example, will reduce these clusters to the cube root of their original density.

For line features, it drops any features that are too small to draw at all. This still leaves the lower zooms too dark (and too dense for the 500K tile limit, in some places), so I need to figure out an equitable way to throw features away.

Any polygons that are smaller than a minimum area (currently 9 square subpixels) will have their probability diffused, so that some of them will be drawn as a square of this minimum size and others will not be drawn at all, preserving the total area that all of them should have had together.

Features in the same tile that share the same type and attributes are coalesced together into a single geometry. You are strongly encouraged to use -x to exclude any unnecessary properties to reduce wasted file size.

If a tile is larger than 500K, it will try encoding that tile at progressively lower resolutions before failing if it still doesn't fit.

Development

Requires protoc (brew install protobuf or apt-get install libprotobuf-dev), and sqlite3 (apt-get install libsqlite3-dev). To build:

make

and perhaps

make install

Name

The name is a joking reference to making tiles.