-
-
Save AlanPew/d3a780e231f19067a4748de3bf48927b 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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment