TileStache: More Then You’re Granddad’s TileCache Server

TileStache: More Then You’re Granddad’s TileCache Server

An overview of the TileStache tiled web mapping server. Presented at the CUGOS Fall Fling Bling, October 2013.

16c4c0d51c30a551af629301cf62ce62?s=128

Matthew Kenny

October 16, 2013
Tweet

Transcript

  1. TileStache: More Then You’re Granddad’s TileCache Server Matt Kenny, Tableau

    Software @mattmakesmaps http://mattmakesmaps.com
  2. Our Lightening-Fast Agenda • What is TileStache? • What does

    it Cache/Render? • How can it be extended?
  3. What is it? “TileStache is a Python-based server application that

    can serve up map tiles based on rendered geographic data.” - http://tilestache.org
  4. Distinct Functionality • Caches: Instructions for storing tiles generated via

    a Provider class instance. • Providers: Instructions for rendering a tile in a specifc format (raster/vector) from a specific data source (postgis/shp). • Configuration File: Links providers with caches.
  5. Caches

  6. Providers • Supported Raster-Based: • mapnik • MBTiles • Remote

    WMS Services
  7. Providers

  8. Providers • Supported Non-Raster Based: • TopoJSON • GeoJSON/BSON •

    Arc GeoServices JSON/BSON (ESRI) • UTF Grids
  9. TopoJSON - Requirements • PostGIS DB • Spherical Mercator (EPSG:900913)

    / WGS84 <-- Out of the Box
  10. TopoJSON - Config Example 01: "layers": { 02: "osm-processed_p10": {

    03: "allowed origin": "*", 04: "provider": { 05: "class": "TileStache.Goodies.VecTiles:Provider", 06: "kwargs": { 07: "dbinfo": { 08: "host": "localhost", 09: "user": "matt", 10: "database": "ts_data" 11: }, 12: "simplify": 10.0, 13: "queries": [ 14: "SELECT gid, geom AS __geometry__ FROM 15: osm.land_polygons_split" 16: ] 17: }}}}
  11. None
  12. None
  13. Extending “It should be quick and easy to understand what

    the library is doing and why... Where possible, dynamic programming “magic” is to be avoided, in favor of basic, procedural and copiously-documented Python.” - Project Docs
  14. Extending class ProviderStub: def __init__(self, layer): # create a new

    provider for a layer raise NotImplementedError def renderTile(self, width, height, srs, coord): # return an object with a PIL-like save() method for a tile raise NotImplementedError def renderArea(self, width, height, srs, xmin, ymin, xmax, ymax, zoom): # return an object with a PIL-like save() method for an area raise NotImplementedError
  15. +

  16. GIF Layer - Config File 01:        "gif_layer":

     { 02:            "provider":  { 03:                "class":  "TileStache.Goodies.Providers.GiphyAPI:Provider", 04:                "kwargs":  { 05:                        "api_key":  "dc6zaTOxFJmzC", 06:                        "search_term":  "pizza-­‐cat", 07:                        "num_gifs":  16, 08:                        "num_threads":  4 09:                        } 10:            } 11:        }
  17. Demo Time http://mattmakesmaps.github.io/TileStache-GiphyAPI-Demo/

  18. Thanks! Slides/Links: http://mattmakesmaps.com twitter: @mattmakesmaps e-mail: matthewkenny@gmail.com