forked from TileStache/TileStache
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
149 lines (94 loc) · 4.19 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
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": {
"example": {
"provider": {"name": "mapnik", "mapfile": "examples/style.xml"},
"projection": "spherical mercator"
}
}
}
# like http://tile.openstreetmap.org/1/0/0.png
coord = ModestMaps.Core.Coordinate(0, 0, 1)
config = TileStache.Config.buildConfiguration(config)
type, bytes = TileStache.getTile(config.layers['example'], coord, 'png')
open('tile.png', 'w').write(bytes)
---- Dependencies ----
Required:
- ModestMaps: http://modestmaps.com, http://github.com/migurski/modestmaps-py
- Python Imaging Library (PIL): http://www.pythonware.com/products/pil
Optional:
- Simplejson: https://github.com/simplejson/simplejson (optional if using >= python 2.6)
- mapnik: http://mapnik.org (optional)
- werkzeug: http://werkzeug.pocoo.org/ (optional)
Install the pure python modules with pip:
sudo pip install -U PIL modestmaps simplejson werkzeug
Install pip (http://www.pip-installer.org/) like:
curl -O https://raw.github.com/pypa/pip/master/contrib/get-pip.py
sudo python get-pip.py
Install Mapnik via instructions at:
http://mapnik.org/download
---- Installation ----
TileStache can be run from the download directory as is. For example the scripts:
tilestache-render.py tilestache-seed.py tilestache-server.py
Can all be run locally like:
./scripts/tilestache-server.py
To install globally do:
python setup.py install
* Note: you may need to prefix that command with 'sudo' to have permissions
to fully install TileStache.
---- Quickstart ----
To make sure TileStache is working start the development server:
./scripts/tilestache-server.py
Then open a modern web browser and you should be able to preview tiles at:
http://localhost:8080/osm/preview.html
This is a previewer that uses ModestMaps and OpenStreetMap tiles from
http://tile.osm.org as defined in the default config file 'tilestache.cfg'
---- Documentation ----
The next step is to learn how build custom layers and serve them.
See http://tilestache.org/doc/ for details.
---- Features ----
Rendering providers:
- Mapnik
- Proxy
- Vector
- Templated URLs
Caching backends:
- Local disk
- Test
- Memcache
- S3
---- 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.
---- License ----
BSD, see LICENSE file.