Google Maps Tile Convert


This little Python script (current version 1.0, released 14. June 2011) converts the name of google maps tiles from a Firefox cache directory into the qrst-coded format used by gMapMaker and other programs. Additionally it can convert single coordinate triples (X,Y,Zoomlevel) into the QRST-format and back.
Starting with no command line parameters makes the program search for every .jpg (Satellite map) and .png file (Hybrid road map overlay) that contain a "x", "sy" and "z" string in the current directory. Those files are then converted to the qrst-coded coordinate format and stored in a kh/z+1 / tt/z+1 subdirectory.
Starting with one command line parameter (which must be a qrst-coded string) transforms this coordinate transforms this string into GM X, Y and Z coordinates.
Starting with three command line parameters (X Y Z) (which must be integer numbers) converts these coordinates into the qrst-coded format.
The QRST format divides the world into 4 tiles at zoomlevel 1: Q (North-West), R (N-E), S (S-E) and T (S-W). In Zoomlevel 0, the world is just one tile. Breaking with the definition above, this tile is named t (and not q), so every tile starts with a t, followed by q,r,s or t, depending in which quadrant of the world the position is located. In Zoomlevel 2, each quadrant is divided in subsequent q,r,s and t quarts again which defines the next character in the QRST-coded filename. A tile of the zoomlevel Z=16 has 17 characters.

A quick example:
If you browse an area in GoogleMaps and use the [File > SavePageAs] feature in FireFox you get an maps.html file and a sub-directory (maps-files) containing all the subparts of the webpage. Included are special 256x256 pixel .jpg files whith square tiles of the displayed maps. If you loaded a hybrid map (with index overlays) there will be also a set of .png files. Your directory may contain files like:

If you look closely at the file names, you will see the coordinate triples

X=35734 Y=22733 Z=16
X=35747 Y=22734 Z=16

whereby the Z-value describes the zoomlevel.
When you run the GMTileConvert script in this directory, it will rename the files to


whereby the directory structure and the GoogleMaps specific QRST-coding is compatible with software like gMapMaker and others.

GMTileConvert Python source code

[ Back...]