This commit is contained in:
Zsolt Ero
2023-12-27 02:21:02 +01:00
parent b85e17b59b
commit a49d276c6e
3 changed files with 36 additions and 6 deletions

View File

@@ -35,11 +35,7 @@ def cli(mbtiles_path: Path, dir_path: Path):
write_tile_files(c, dir_path=dir_path)
# planetiler has missing tiles by design, so disabling this
# if it's a full planet run,
# make sure there are exactly the right number of files generated
# if 'planet' in mbtiles_path.resolve().parent.name:
# assert count_files(dir_path / 'tiles') == calculate_tiles_sum(14)
# print(f'Tile number: {calculate_tiles_sum(14)} - OK')
# assert_all_tiles_present(mbtiles_path, dir_path)
write_metadata(c, dir_path=dir_path)
print('extract_mbtiles.py DONE')
@@ -113,6 +109,17 @@ def write_tile_files(c, *, dir_path):
raise
def assert_all_tiles_present(mbtiles_path, dir_path):
"""
If it's a full planet run,
ake sure there are exactly the right number of files generated.
"""
if 'planet' in mbtiles_path.resolve().parent.name:
assert count_files(dir_path / 'tiles') == calculate_tiles_sum(14)
print(f'Tile number: {calculate_tiles_sum(14)} - OK')
def count_files(folder):
total = 0
for root, dirs, files in os.walk(folder):

File diff suppressed because one or more lines are too long