Created: 2011-07-07 11:06
Updated: 2017-04-03 15:39
License: other

canvasback serves geometries for use in web maps. The basic idea is to be like a geojson vector layer, but with binary arrays of geospatial records, which can be less than 1/10 the size of geojson and render really quickly. A client-side project to render them is available at - it uses a couple of the native binary data api's in current web browsers.

the current master branch

uses an experimental data format. For original Well-Known Binary implementation, see the wellknownbinary tag. This new thing serves up an array of records like this:

uint32 geometry_type // same as wkb
uint32 num_pts // like wkb
uint32 osm_type // based on highway taxonomy, not required, alternatively for things like building height
int16[num_pts] // wat

A tile map service (google style) query of the form:


returns an array of the above records, but the coordinates are pairs of 2 byte integer offsets from the tile origin (in all other ways, the format is basically well-known binary (pdf spec)).

Caveats to the approach in general are that you have to 1) use typical clippped tiles and/or 2) know in advance that your geometry won't be too big. 1 makes sense anyway and for 2, a primary use case for this is loading lots of building geometries where the query is done on centroids and ground area is predictably scaled.

The advantage is speed and compactness, for example here is every unsimplified building in a good chunk of northeast San Francisco at zoom 16, which renders imperceptibly quick and averages 35k per tile (more realistic zoom levels are much smaller!):

Here's every node and way in OSM SF at zoom level 13, at a size comparable to png:

More demos etc forthcoming

To use: edit db.conf.c with your database settings, adapt the queries in canvasback.c for your different zoom levels, then:



Access at: http://localhost:7987/whatever/tms/Z/X/Y.someext

(any thing of the form /tms/k/n/m should work, but tms is required, ie,11,12)

Dependencies: Postgres and PostGIS

Canvasback duck with ducklings:

canvasback example

Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more