Skip to content

gundersen/TileStache

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TileStache: a stylish alternative for caching your map tiles.

TileStache is a Python-based server application that can serve up map tiles
based on rendered geographic data. You might be familiar with TileCache
(http://tilecache.org), the venerable open source WMS server from MetaCarta.
TileStache is similar, but we hope simpler and better-suited to the needs of
designers and cartographers.

---- Synopsis ----

    import TileStache
    import ModestMaps
    
    config = {
      "cache": {"name": "Test"},
      "layers": {
        "ex": {
            "provider": {"name": "mapnik", "mapfile": "style.xml"},
            "projection": "spherical mercator"
        } 
      }
    }
    
    # like http://tile.openstreetmap.org/12/656/1582.png
    coord = ModestMaps.Core.Coordinate(1582, 656, 12)
    config = TileStache.Config.buildConfiguration(config)
    type, bytes = TileStache.handleRequest(config.layers['ex'], coord, 'png')
    
    open('tile.png', 'w').write(bytes)

---- Features ----

Rendering providers:
- Mapnik
- Proxy

Caching backends:
- Local disk
- Test

---- Design Goals ----

The design of TileStache focuses on approachability at the expense of
cleverness or completeness. Our hope is to make it easy for anyone to design
a new map of their city, publish a fresh view of their world, or even build
the next 8-Bit NYC (http://8bitnyc.com).

* Small

The core of TileStache is intended to have a small code footprint.
It should be quick and easy to to understand what the library is doing and
why, based on common entry points like included CGI scripts. Where possible,
dynamic programming "magic" is to be avoided, in favor of basic, procedural
and copiously-documented Python.

* Pluggable

We want to accept plug-ins and extensions from outside TileStache, and offer
TileStache itself as an extension for other systems. It must be possible to
write and use additional caches or renderers without having to modify the
core package itself, extend classes from inside the package, or navigate
chains of class dependencies. Duck typing and stable interfaces win.

* Sensible Defaults

The default action of a configured TileStache instance should permit the most
common form of interaction: a worldwide, spherical-mercator upper-left oriented
tile layout compatible with those used by OpenStreetMap, Google, Bing Maps,
Yahoo! and others. It should be possible to make TileStache do whatever is
necessary to support any external system, but we eschew complex, impenetrable
standards in favor of pragmatic, fast utility with basic web clients.

---- Functions ----

cgiHandler(environ, config='./tilestache.cfg', debug=False)
    Read environment PATH_INFO, load up configuration, talk to stdout by CGI.

handleRequest(layer, coord, extension)
    Get a type string and image binary for a given request layer tile.
    
    Arguments:
    - layer: instance of Core.Layer to render.
    - coord: one ModestMaps.Core.Coordinate corresponding to a single tile.
    - extension: filename extension to choose response type, e.g. "png" or "jpg".
    
    This is the main entry point, after site configuration has been loaded
    and individual tiles need to be rendered.

parseConfigfile(configpath)
    Parse a configuration file and return a Configuration object.
    
    Configuration file is formatted as JSON with two sections, "cache" and "layers":
    
      {
        "cache": { ... },
        "layers": {
          "layer-1": { ... },
          "layer-2": { ... },
          ...
        }
      }
    
    The full filesystem path to the file is significant, used
    to resolve any relative paths found in the configuration.
    
    See the Caches module for more information on the "caches" section,
    and the Core and Providers modules for more information on the
    "layers" section.

---- Dependencies ----

- ModestMaps: http://modestmaps.com, http://github.com/migurski/modestmaps-py
- mapnik: http://mapnik.org (optional)

---- License ----

BSD? (decide!)

About

A stylish alternative for caching your map tiles.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published