Created
December 7, 2011 19:00
-
-
Save incanus/1444124 to your computer and use it in GitHub Desktop.
Shell script to get basic info from the metadata of 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
#!/bin/sh | |
if [ -z $1 ]; then | |
echo "Usage: $0 <filename.mbtiles>" | |
exit 1 | |
fi | |
sqlite3 -line $1 'select * from metadata;' | sed -e 's/^\(.\{85\}\).*/\1.../' -e 's/^ name = /+++/' -e 's/value = //' | grep -v ^$ | sed -e 's/^\([^+++]\)/ \1/' -e 's/^+++//' | |
echo "size" | |
count=`sqlite3 -line $1 'select count(*) from tiles;' | awk '{ print $3 }'` | |
filesize=$((`stat -f %z $1` / 1024 / 1024)) | |
echo " $count tiles ($filesize MB)" | |
echo "zooms" | |
minzoom=`sqlite3 -line $1 'select min(zoom_level) from tiles;' | awk '{ print $3 }'` | |
maxzoom=`sqlite3 -line $1 'select max(zoom_level) from tiles;' | awk '{ print $3 }'` | |
if [ minzoom != maxzoom ]; then | |
echo " $minzoom-$maxzoom" | |
else | |
echo " $minzoom" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment