TileStache生成切片
1.tilestache.cfg
{ "cache": { "name": "Disk", "path": "tmp/stache", "verbose": true }, "layers": { "roads": {
"provider": {
"name": "mbtiles",
"tileset": "google/map/Washington/open-streets-dc.mbtiles"
}
},
"roadsgrid":{
"provider": {
"class": "TileStache.Goodies.Providers.MapnikGrid:Provider",
"kwargs":
{
"mapfile": "google/map/Washington/open-streets-dc.xml",
"fields":["name", "type"],
"layer_index": 0,
"wrapper": "grid",
"scale": 4
}
}
},
"adminShp": { "provider": { "name": "vector", "driver": "shapefile", "parameters": { "file": "file://F:/google/map/santiago/shapefiles/admin.shp" } } }, "places": { "provider": { "name": "vector", "driver": "PostgreSQL", "parameters": { "host": "127.0.0.1", "port": 5432, "dbname": "geodb", "user": "postgres", "password": "gis", "table": "santiago_chile_osm_places" } }, "projected": true, "metatile": { "rows": 3, "columns": 3, "buffer": 64 } }, "admin": { "provider": { "name": "vector", "driver": "PostgreSQL", "parameters": { "host": "127.0.0.1", "port": 5432, "dbname": "geodb", "user": "postgres", "password":"gis", "table": "santiago_chile_osm_admin" } }, "projected": true, "metatile": { "rows": 3, "columns": 3, "buffer": 64 } }, "UTFGrid": { "provider": { "name": "mapnik grid", "mapfile": "file://F:/google/map/santiago/santiago.xml", "layers": [ [1, ["name","type"]], [2, ["name","population"]] ] }, "projected": true, "metatile": { "rows": 3, "columns": 3, "buffer": 64 } } } }
2. TileStacheTest.py
import TileStache import TileStache.MBTiles import werkzeug from werkzeug.serving import run_simple from werkzeug.wrappers import Request, Response configFile = "D:/Project/JavaScript/LeafletJS/LeafletWebGISDemo/src/python/TileStache/tilestache.cfg" configFile = "file://F:/google/map/santiago/tilestache.cfg" # configFile = "tilestache.cfg" application = TileStache.WSGITileServer(configFile) werkzeug.serving.run_simple('localhost', 8080, application) ''' @Request.application def application(request): return Response('Hello World!') if __name__ == '__main__': from werkzeug.serving import run_simple run_simple('localhost', 4000, application) '''
3. tilestache-seed
tilestache-seed.py -b -33.8294 -71.0362 -33.1445 -70.3331 -p 0 -e geojson -c tilestache.cfg -l adminShp 9 10 11
Maperitive Mapnik style rule