Created
February 21, 2011 22:48
-
-
Save rosskarchner/837851 to your computer and use it in GitHub Desktop.
extract tiles from an mbtiles file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sqlite3, os | |
conn = sqlite3.connect('Mills1860.mbtiles') | |
results=conn.execute('select * from tiles').fetchall() | |
for result in results: | |
zoom, column, row, png= result | |
try: | |
os.makedirs('%s/%s/' % (zoom, row)) | |
except: | |
pass | |
tile_out=open('%s/%s/%s.png' % (zoom, row, column), 'wb') | |
tile_out.write(png) | |
tile_out.close() |
Yeah, mb-util probably is the right answer for most people stumbling on this: https://github.com/mapbox/mbutil
It was problematic when I tried, but that was a year ago.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Extraction works but Coordinates arent correct. You can use mb-util for simple extraction.