Book Image

QGIS Python Programming Cookbook

Book Image

QGIS Python Programming Cookbook

Overview of this book

Table of Contents (16 chapters)
QGIS Python Programming Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creating tiles from a QGIS map


This recipe creates a set of Internet web map tiles from your QGIS map. What's interesting about this recipe is that once the static map tiles are generated, you can serve them up locally or from any web-accessible directory using the client-side browser's JavaScript without the need of a map server, or you can serve them (for example, distribute them on a portable USB drive).

Getting ready

You will need to download the zipped shapefile from https://geospatialpython.googlecode.com/svn/countries.zip.

Unzip the shapefile to a directory named shapes in your qgis_data directory. Next, create a directory called tilecache in your qgis_data directory. You will also need to install the QTiles plugin using the QGIS Plugin Manager. This plugin is experimental, so make sure that the Show also experimental plugins checkbox is checked in the QGIS Plugin Manager's Settings tab.

How to do it...

We will load the shapefile and randomly color each country. We'll then manipulate the...