TileStache / TileStache

A stylish alternative for caching your map tiles.
http://tilestache.org
BSD 3-Clause "New" or "Revised" License
758 stars 290 forks source link

mbtiles apparently not working #330

Open ghost opened 6 years ago

ghost commented 6 years ago

Hi I just got the following error while trying to serve an mbtiles layer. Mbtiles was generated with tilemill.

Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/werkzeug/serving.py", line 270, in run_wsgi execute(self.server.app) File "/usr/local/lib/python2.7/dist-packages/werkzeug/serving.py", line 258, in execute application_iter = app(environ, start_response) File "/usr/local/lib/python2.7/dist-packages/TileStache-1.51.6-py2.7.egg/TileStache/init.py", line 393, in call status_code, headers, content = requestHandler2(self.config, path_info, query_string, script_name) File "/usr/local/lib/python2.7/dist-packages/TileStache-1.51.6-py2.7.egg/TileStache/init.py", line 266, in requestHandler2 status_code, headers, content = layer.getTileResponse(coord, extension) File "/usr/local/lib/python2.7/dist-packages/TileStache-1.51.6-py2.7.egg/TileStache/Core.py", line 426, in getTileResponse tile = self.render(coord, format) File "/usr/local/lib/python2.7/dist-packages/TileStache-1.51.6-py2.7.egg/TileStache/Core.py", line 513, in render tile = provider.renderTile(width, height, srs, coord) File "/usr/local/lib/python2.7/dist-packages/TileStache-1.51.6-py2.7.egg/TileStache/MBTiles.py", line 225, in renderTile mime_type, content = get_tile(self.tileset, coord) File "/usr/local/lib/python2.7/dist-packages/TileStache-1.51.6-py2.7.egg/TileStache/MBTiles.py", line 167, in get_tile mime_type = formats[format] KeyError: 'png8'

waissbluth commented 6 years ago

Same here.

On https://github.com/TileStache/TileStache/blob/master/TileStache/MBTiles.py#L167, an image format (e.g. “png”) is looked up in a dictionary, and a mime_type (e.g. “image/png”) for that image format is gotten.

On https://github.com/TileStache/TileStache/blob/master/TileStache/MBTiles.py#L233, that mime_type is again looked up in the same dictionary, which gives an error, because there is no such key (the key is “png”, not “image/png”)

ghost commented 6 years ago

@waissbluth see this commit:

https://github.com/jucajuca/TileStache/commit/1c2c913e5254af30e3cbae64a389dfa35080bb2a

it is far from perfect, but...