Skip to content

Instantly share code, notes, and snippets.

@lukasmartinelli
Created December 11, 2015 18:22
Show Gist options
  • Save lukasmartinelli/34c15eff519717598c7e to your computer and use it in GitHub Desktop.
Save lukasmartinelli/34c15eff519717598c7e to your computer and use it in GitHub Desktop.
Find out missing MBTiles at certain zoom level from list of files

Find the real tiles that should exist.

mercantile children "[0,0,0]" --depth 8 > correct_tiles.txt

Find the list of MBTiles from S3

aws s3 ls s3://osm2vectortiles > real_tiles.txxt

Bring both in to the same format and also sort them.

awk '{print $4;}' list_of_mbtiles.txt \
| sed 's/_z8-z14.mbtiles/_8/g' \
| sed 's/_/\//g' \
| sort > fixed_real_tiles.txt
cat mercantile_children.txt \
| sed 's/, /\//g' \
| sed 's/\[//g' \
| sed 's/\]//g' \
| sort > fixed_correct_tiles.txt

Find out the missing tiles

diff --unchanged-line-format="" fixed_correct_tiles.txt fixed_real_tiles.txt > missing_tiles.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment