mbutil
Advanced tools
+15
-15
@@ -157,8 +157,11 @@ #!/usr/bin/env python | ||
| for y in ys: | ||
| if (y.endswith(image_format)): | ||
| f = open(os.path.join(r1, z, x, y), 'rb') | ||
| y, ext = y.split('.', 1) | ||
| if (ext == image_format): | ||
| f = open(os.path.join(r1, z, x, y+'.'+ext), 'rb') | ||
| if kwargs.get('scheme') == 'xyz': | ||
| y = flip_y(int(z), int(y)) | ||
| cur.execute("""insert into tiles (zoom_level, | ||
| tile_column, tile_row, tile_data) values | ||
| (?, ?, ?, ?);""", | ||
| (z, x, y.split('.')[0], sqlite3.Binary(f.read()))) | ||
| (z, x, y, sqlite3.Binary(f.read()))) | ||
| f.close() | ||
@@ -170,3 +173,3 @@ count = count + 1 | ||
| sys.stdout.write(msg) | ||
| elif (y.endswith('grid.json')): | ||
| elif (ext == 'grid.json'): | ||
| if grid_warning: | ||
@@ -189,6 +192,3 @@ logger.warning('grid.json interactivity import not yet supported\n') | ||
| service_version = metadata.get('version', '1.0.0') | ||
| base_path = os.path.join(directory_path, | ||
| service_version, | ||
| metadata.get('name', 'layer') | ||
| ) | ||
| base_path = directory_path | ||
| if not os.path.isdir(base_path): | ||
@@ -210,3 +210,3 @@ os.makedirs(base_path) | ||
| y = t[2] | ||
| if kwargs.get('scheme') == 'osm': | ||
| if kwargs.get('scheme') == 'xyz': | ||
| y = flip_y(z,y) | ||
@@ -239,3 +239,8 @@ print 'flipping' | ||
| y = g[2] # y | ||
| if kwargs.get('scheme') == 'osm': | ||
| grid_data_cursor = con.execute('''select key_name, key_json FROM | ||
| grid_data WHERE | ||
| zoom_level = %(zoom_level)d and | ||
| tile_column = %(tile_column)d and | ||
| tile_row = %(y)d;''' % locals() ) | ||
| if kwargs.get('scheme') == 'xyz': | ||
| y = flip_y(zoom_level,y) | ||
@@ -249,7 +254,2 @@ grid_dir = os.path.join(base_path, str(zoom_level), str(tile_column)) | ||
| # join up with the grid 'data' which is in pieces when stored in mbtiles file | ||
| grid_data_cursor = con.execute('''select key_name, key_json FROM | ||
| grid_data WHERE | ||
| zoom_level = %(zoom_level)d and | ||
| tile_column = %(tile_column)d and | ||
| tile_row = %(tile_row)d;''' % locals()) | ||
| grid_data = grid_data_cursor.fetchone() | ||
@@ -256,0 +256,0 @@ data = {} |
+1
-1
| Metadata-Version: 1.0 | ||
| Name: mbutil | ||
| Version: 0.1.0 | ||
| Version: 0.1.1 | ||
| Summary: An importer and exporter for MBTiles | ||
@@ -5,0 +5,0 @@ Home-page: https://github.com/mapbox/mbutil |
+1
-1
@@ -5,3 +5,3 @@ from distutils.core import setup | ||
| name='mbutil', | ||
| version='0.1.0', | ||
| version='0.1.1', | ||
| author='Tom MacWright', | ||
@@ -8,0 +8,0 @@ author_email='tom@macwright.org', |
+7
-0
@@ -24,1 +24,8 @@ import os, shutil | ||
| assert os.path.exists('test/output/one.mbtiles') | ||
| @with_setup(clear_data, clear_data) | ||
| def test_utf8grid_mbtiles_to_disk(): | ||
| mbtiles_to_disk('test/data/utf8grid.mbtiles', 'test/output') | ||
| assert os.path.exists('test/output/1.0.0/utf8grid/0/0/0.grid.json') | ||
| assert os.path.exists('test/output/1.0.0/utf8grid/0/0/0.png') | ||
| assert os.path.exists('test/output/metadata.json') |
Sorry, the diff of this file is not supported yet
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
19055
1.76%280
2.19%