Slippy map tile generator for QGIS

About

This program is a slippy map tile generator for use with QGIS. All rendering is done by QGIS so what you see on your screen is what you'll get in your output tiles. Functionally it is quite similar to the QTiles plugin. Here's a comparison of the two:

Advantages of this program

Disadvantages of this program

Comments are welcome, see the email link at the bottom of the page.

Downloads

This code can also be found on Github (offsite link).
This code has also been ported to QGIS 3 (offsite link).
Current version:

v0.2.1 Documentation updates, added scale presets file (no code changes)

tile_writer.0.2.1.tar.gz All the files in tar.gz format
tile_writer.0.2.1.zip All the files in zip format
tile_writer.py The main script
readme.txt Usage instructions
globalmercator.py Implements the GlobalMercator class which is used to perform latitude/longitude to tile coordinate conversions. Taken from GDAL2Tiles.
scales.xml Scale presets for QGIS that match the tile zoom levels
Old versions:

Usage

Preliminary steps

Running the script

Note that QGIS may appear to have locked up while generating the regional tiles. If this happens simply be patient; complex maps may take several minutes to draw.
The script will avoid regenerating images whenever possible. This means that if you want to regenerate a map you should either specify a different output_path or first delete all of the tile directories (numbered) as well as the region tiles (e.g. "10_300_651_s16_b2.png").

Configuration variables

These are found near the top of tile_writer.py and should be changed as appropriate before running the script.

Zoom levels

If you are using scale-dependant feature visibility you should use the scales listed below when deciding visibility.
These scales can be downloaded here and installed in QGIS using:
Settings → Options → Map Tools → Predefined Scales → Import from file (folder icon)
Level Scale
1 1 : 295,829,355.45
2 1 : 147,914,677.73
3 1 : 73,957,338.86
4 1 : 36,978,669.43
5 1 : 18,489,334.72
6 1 : 9,244,667.36
7 1 : 4,622,333.68
8 1 : 2,311,166.84
9 1 : 1,155,583.42
10 1 : 577,791.71
11 1 : 288,895.85
12 1 : 144,447.93
13 1 : 72,223.96
14 1 : 36,111.98
15 1 : 18,055.99
16 1 : 9,028.00
17 1 : 4,514.00
18 1 : 2,257.00
19 1 : 1,128.50
20 1 : 564.25
21 1 : 282.12
22 1 : 141.06
23 1 : 70.53
See also:
Did you find this page useful? Want to say thanks? Consider leaving a tip via PayPal:

Other GIS pages on this site

I make no warranty or representation, either express or implied, with respect the behavior of this script, its quality, performance, accuracy, merchantability, or fitness for a particular purpose. This script is provided 'as is', and you, by making use thereof, are assuming the entire risk. That said, I hope you this script useful. Have fun!