Slide 1

Slide 1 text

TileStache: More Then You’re Granddad’s TileCache Server Matt Kenny, Tableau Software @mattmakesmaps http://mattmakesmaps.com

Slide 2

Slide 2 text

Our Lightening-Fast Agenda • What is TileStache? • What does it Cache/Render? • How can it be extended?

Slide 3

Slide 3 text

What is it? “TileStache is a Python-based server application that can serve up map tiles based on rendered geographic data.” - http://tilestache.org

Slide 4

Slide 4 text

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.

Slide 5

Slide 5 text

Caches

Slide 6

Slide 6 text

Providers • Supported Raster-Based: • mapnik • MBTiles • Remote WMS Services

Slide 7

Slide 7 text

Providers

Slide 8

Slide 8 text

Providers • Supported Non-Raster Based: • TopoJSON • GeoJSON/BSON • Arc GeoServices JSON/BSON (ESRI) • UTF Grids

Slide 9

Slide 9 text

TopoJSON - Requirements • PostGIS DB • Spherical Mercator (EPSG:900913) / WGS84 <-- Out of the Box

Slide 10

Slide 10 text

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: }}}}

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

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

Slide 14

Slide 14 text

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

Slide 15

Slide 15 text

+

Slide 16

Slide 16 text

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:        }

Slide 17

Slide 17 text

Demo Time http://mattmakesmaps.github.io/TileStache-GiphyAPI-Demo/

Slide 18

Slide 18 text

Thanks! Slides/Links: http://mattmakesmaps.com twitter: @mattmakesmaps e-mail: [email protected]