Standard Tile Cache Folder Structure

1214
1
03-25-2019 10:20 AM
Status: Open
Labels (1)
TysonBarlow
New Contributor III

The standard tile cache structure, as developed by Google, is a set of folders and files representing the zoom, row, and columns. A URL for a tile would end something like this: /tile/{z}/{y}/{x}

 

The current exploded cache structure from Esri using the Manage Tile Cache tool has all the right folders and files with filenames representing the zoom, row, and column numbers, but it uses hexadecimal numbers like R0032b9d0 to name the folders and files (not good!). 

 

Please consider a new tool or update an existing tool that will allow us to create a tile cache with the ZYX folder structure mentioned above. It is a format that is the standard for map tile caches, and Esri's products do not support an option to create tile caches in that format.

1 Comment
MaximeDemers

That's right.

If interested, we are using this bash script on unix to convert the folder structure to Z/X/Y.png

You could adapt it to convert it to Z/Y/X easily

 

#!/bin/bash
#Run this script in the directory containing the Zoom Level directories in ESRI's standard Online output format (L00-L19). 
#Copy all the content in the 'ConvertedFiles' folder into the location that is symbolically linked in '/var/www/'.

#Time Counter
SECONDS=0

#Rename Zoom Level Directories 
shopt -s extglob
for i in L0[^1-9];
 do mv "$i" "${i##*(L0)}";
done
for i in L0[^0];
 do mv "$i" "${i##*(L0)}";
done
for i in L*;
 do mv "$i" "${i##*(L)}";
done

#Convert folder and filenames from Hex to Decimal and reorder+rename data to be ../zoom_level/X/Y.png.
set -m # Enable Job Control

convert()
{
  OLDNAME=`basename $I .png`
  SEP1=${I#./}
  SEP2=${SEP1%%/*.png}
  SEP3=${SEP1%%/C*}
  SEP4=${SEP3#*/R}
  SEP5=${OLDNAME#C}
  YDECIMAL=$(echo $((16#$SEP4)))
  XDECIMAL=$(echo $((16#$SEP5)))
  mkdir -p "ConvertedFiles/$SEP2/$XDECIMAL"
  mv "$I" "ConvertedFiles/$SEP2/$XDECIMAL/$YDECIMAL.png"
  echo -n \|
}

for I in `find . -type f -maxdepth 3 -mindepth 2 -name *.png`
do
 convert $I &
done

echo '-----------END-----------'
echo 'Completed in' $(($SECONDS)) 'seconds.'