Tutorial: Making Map Tiles with gdal

Given a raster image in QGIS (for instance, one created by using the georeferencer plugin), you can export it in a format that can be easily turned into map tiles.

Exporting a georeferenced raster file from QGIS

Select the raster layer you’ve created in QGIS: right click on it and select “Save as” –choose a destination layer, and, next to “GTiff,” check the box for “Create VRT.” That will save a file; you can upload or email that to the course web site and I’ll put a version online like the one here.

Once it’s saved as a VRT, it’s easy on the command line to build up a set of map tiles for use anywhere. On a Mac or Linux machine, the way to do that would be to change into the directory where you’re storing the vrt file, and type in the terminal:

An aside: You can do this, in fact, on any sort of file: for example, a massive PNG generated by R:

Serves to categorize the file as a raster image–on its own, this won’t align with anything, but it can be a nice easy way to build a tiled image browser.

One thought on “Tutorial: Making Map Tiles with gdal

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">