Python: module TileStache.Config

TileStache.Config | index

`The configuration bits of TileStache.
TileStache configuration is stored in JSON files, and is composed of two main
top-level sections: "cache" and "layers". There are examples of both in this
minimal sample configuration:
{
"cache": {"name": "Test"},
"layers": {
"example": {
"provider": {"name": "mapnik", "mapfile": "examples/style.xml"},,
"projection": "spherical mercator"
}
}
}
The contents of the "cache" section are described in greater detail in the
TileStache.Caches module documentation. Here is a different sample:
"cache": {
"name": "Disk",
"path": "/tmp/stache",
"umask": "0000"
}
The "layers" section is a dictionary of layer names which are specified in the
URL of an individual tile. More detail on the configuration of individual layers
can be found in the TileStache.Core module documentation. Another sample:
{
"cache": ...,
"layers":
{
"example-name":
{
"provider": { ... },
"metatile": { ... },
"preview": { ... },
"stale lock timeout": ...,
"projection": ...
}
}
}
Configuration also supports these additional settings:
- "logging": one of "debug", "info", "warning", "error" or "critical", as
described in Python's logging module: http://docs.python.org/howto/logging.html
- "index": configurable index pages for the front page of an instance.
A custom index can be specified as a filename relative to the configuration
location. Typically an HTML document would be given here, but other kinds of
files such as images can be used, with MIME content-type headers determined
by mimetypes.guess_type. A simple text greeting is displayed if no index
is provided.
In-depth explanations of the layer components can be found in the module
documentation for TileStache.Providers, TileStache.Core, and TileStache.Geography.`

Modules
`` |  |
TileStache.Caches TileStache.Core | TileStache.Geography TileStache.Providers | logging sys |

Classes
`` |  | Bounds BoundsList Configuration
class Bounds
`` | `Coordinate bounding box for tiles.`
| Methods defined here: __init__(self, upper_left_high, lower_right_low) `Two required Coordinate objects defining tile pyramid bounds. Boundaries are inclusive: upper_left_high is the left-most column, upper-most row, and highest zoom level; lower_right_low is the right-most column, furthest-dwn row, and lowest zoom level.` __str__(self) excludes(self, tile) `Check a tile Coordinate against the bounds, return true/false.`
class BoundsList
`` | `Multiple coordinate bounding boxes for tiles.`
| Methods defined here: __init__(self, bounds) `Single argument is a list of Bounds objects.` excludes(self, tile) `Check a tile Coordinate against the bounds, return false if none match.`
class Configuration
`` | `A complete site configuration, with a collection of Layer objects. Attributes: cache: Cache instance, e.g. TileStache.Caches.Disk etc. See TileStache.Caches for details on what makes a usable cache. layers: Dictionary of layers keyed by name. When creating a custom layers dictionary, e.g. for dynamic layer collections backed by some external configuration, these dictionary methods must be provided for a complete collection of layers: keys(): Return list of layer name strings. items(): Return list of (name, layer) pairs. __contains__(key): Return boolean true if given key is an existing layer. __getitem__(key): Return existing layer object for given key or raise KeyError. dirpath: Local filesystem path for this configuration, useful for expanding relative paths. Optional attribute: index: Mimetype, content tuple for default index response.`
| Methods defined here: __init__(self, cache, dirpath)

Functions
`` |  | buildConfiguration(config_dict, dirpath='.') `Build a configuration dictionary into a Configuration object. The second argument is an optional dirpath that specifies where in the local filesystem the parsed dictionary originated, to make it possible to resolve relative paths. It might be a path or more likely a full URL including the "file://" prefix.` enforcedLocalPath(relpath, dirpath, context='Path') `Return a forced local path, relative to a directory. Throw an error if the combination of path and directory seems to specify a remote path, e.g. "/path" and "http://example.com". Although a configuration file can be parsed from a remote URL, some paths (e.g. the location of a disk cache) must be local to the server. In cases where we mix a remote configuration location with a local cache location, e.g. "http://example.com/tilestache.cfg", the disk path must include the "file://" prefix instead of an ambiguous absolute path such as "/tmp/tilestache".` loadClassPath(classpath) `Load external class based on a path. Example classpath: "Module.Submodule:Classname". Equivalent soon-to-be-deprecated classpath: "Module.Submodule.Classname".`

Data
`` |  | modules = {'FixTk': <module 'FixTk' from '/System/Library/Frameworks...ork/Versions/2.7/lib/python2.7/lib-tk/FixTk.pyc'>, 'ModestMaps': <module 'ModestMaps' from '/Users/migurski/Sites...python2.7/site-packages/ModestMaps/__init__.pyc'>, 'ModestMaps.BlueMarble': <module 'ModestMaps.BlueMarble' from '/Users/mig...thon2.7/site-packages/ModestMaps/BlueMarble.pyc'>, 'ModestMaps.CloudMade': <module 'ModestMaps.CloudMade' from '/Users/migu...ython2.7/site-packages/ModestMaps/CloudMade.pyc'>, 'ModestMaps.Core': <module 'ModestMaps.Core' from '/Users/migurski/...lib/python2.7/site-packages/ModestMaps/Core.pyc'>, 'ModestMaps.Geo': <module 'ModestMaps.Geo' from '/Users/migurski/S.../lib/python2.7/site-packages/ModestMaps/Geo.pyc'>, 'ModestMaps.MapQuest': <module 'ModestMaps.MapQuest' from '/Users/migur...python2.7/site-packages/ModestMaps/MapQuest.pyc'>, 'ModestMaps.Microsoft': <module 'ModestMaps.Microsoft' from '/Users/migu...ython2.7/site-packages/ModestMaps/Microsoft.pyc'>, 'ModestMaps.OpenStreetMap': <module 'ModestMaps.OpenStreetMap' from '/Users/...n2.7/site-packages/ModestMaps/OpenStreetMap.pyc'>, 'ModestMaps.PIL': None, ...} stderr = <open file '<stderr>', mode 'w'>