1

I want to use tilestache to get geojson files. I hava run tilestache-server.py -c tilestache.cfg ,and it works well.

However,I want to get tiles from data stored in postgis. Maybe it will need to run tilestache-seed.py. So I run`

tilestache-seed.py -c ~/TileStache-1.49.8/cfg1 -b 32.000 114.000 31.000 115.000 -l postgis 12  -e geojson

then I got

Traceback (most recent call last):

File "/usr/local/bin/tilestache-seed.py", line 331, in mimetype, content = getTile(layer, coord, extension, options.ignore_cached) File "/usr/local/lib/python2.7/dist-packages/TileStache/init.py", line 64, in getTile status_code, headers, body = layer.getTileResponse(coord, extension, ignore_cached) File "/usr/local/lib/python2.7/dist-packages/TileStache/Core.py", line 414, in getTileResponse tile = self.render(coord, format) File "/usr/local/lib/python2.7/dist-packages/TileStache/Core.py", line 500, in render tile = provider.renderTile(width, height, srs, coord) File "/usr/local/lib/python2.7/dist-packages/TileStache/Vector/init.py", line 583, in renderTile layer, ds = _open_layer(self.driver, self.parameters, self.layer.config.dirpath) File "/usr/local/lib/python2.7/dist-packages/TileStache/Vector/init.py", line 453, in _open_layer raise KnownUnknown('Couldn\'t get a layer from data source %s' % source_name) TileStache.Core.KnownUnknown: Couldn't get a layer from data source PG:dbname='osmgis' user='postgres' host='127.0.0.1' password='xxxxxx'port='5432'

here is my cfg1

{

"cache": { "name": "Disk", "path": "~/TileStache-1.49.8/stache", "umask": "0000" }, "layers": { "postgis": { "provider": { "name": "vector", "driver": "PostgreSQL", "parameters": { "dbname": "osmgis", "user": "postgres", "password":"xxxxxx", "host": "127.0.0.1", "port": 5432, "query": "SELECT ST_AsGeojson(geom) from wuhan_osm_roads"}} }

I am a beginner ,and I don't know how to solve the problem.

by the way, if i delete "12" behind "postgis" in code,it works but output nothing.

1

Make sure your geometry columns contain the correct SRID. Run:

psql osmgis -c 'select * from geometry_columns;'

If your layer a) is not there, or b) has a SRID of 0, you'll need to look up how to remedy that so that the layer is there with the correct SRID. The right way to do that depends on your version of PostGIS.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.