Skip to content

Instantly share code, notes, and snippets.

@bjornharrtell
Created July 15, 2016 09:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjornharrtell/7f4b6c030d4faa63f99b1ceb6f3edcef to your computer and use it in GitHub Desktop.
Save bjornharrtell/7f4b6c030d4faa63f99b1ceb6f3edcef to your computer and use it in GitHub Desktop.
ST_AsMVT and ST_AsGeobuf

ST_AsMVT

Purpose

Support MapBox vector tiles as an output format directly from PostGIS.

API

Arguments

  • Layers (list of table/view names)
  • Extent (bounding box)
  • Buffer (in geometry units)
  • Tile extent (default 4046)

Implementation parts

  • Mapbox Vector Tile encoder in C (geometry encoding, attribute transfer)
  • Logic to fetch geometries from selected tables and clip to buffered tile extent
  • Logic to scale/simplify geometries to internal tile coordinate space
  • Tests

Existing stuff that should/might be useful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment