Created
November 13, 2014 21:33
-
-
Save kannes/ebfe021458f96e4f30b5 to your computer and use it in GitHub Desktop.
tms2xyz.sh
This file contains hidden or 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/bash | |
# rename TMS tiles to the XYZ schema | |
# no quoting, since all files have simple numeric names | |
# do not run this anywhere else than INSIDE your tiles directory | |
# run it like this: find . -name "*.png" -exec ./tms2xyz.sh {} \; | |
filename=$1 | |
tmp=${filename#*/} # remove to first / | |
z=${tmp%%/*} # remove from first / | |
tmp=${filename%/*} # remove from last / | |
x=${tmp##*/} # remove to last / | |
tmp=${filename##*/} # remove to last / | |
y=${tmp%.*} # remove from first . | |
extension=${filename##*.} | |
let newy="2**$z-$y-1" # calculate the xyz tile | |
#echo $z $x $y $newy $extension | |
# remove the echo if you are sure you want to do this | |
echo mv ${filename} ./$z/$x/$newy.$extension |
Asking for it if you still have it (:
Asking for what? ;)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Asking for it if you still have it (: