As an effort for participation in the OpenSource community in general, and the OSGeo community in particular, Oslandia develops free software for research and development, internal needs, client needs or sometimes just for fun !
Of course we work with the community, publish source code, work together in order to leverage the power of OpenSource to its full extent.
This time, we publish a small but very convenient Quantum GIS plugin, named «Atlas». This a a map book tool, and it fills a gap in QGIS features, as such a fonctionality is a long-awaited one. (The easyprint plugin was great but lacked easy customization). Let’s show you what this Atlas plugin is about.
The Atlas plugin helps you create map books, or series of maps, in an automated way. The concept is to use a coverage layer, wich contains geometries and fields. This layer will define the maps to output. You can create image files or PDF files. All the composition is done in the QGIS map composer, and a specific composition is used as a template.
The plugin allows to replace text labels set up in the composer, with coverage layer’s attribute values, enabling you to set a title, comment, document name, page number, or any dynamic information you want to display on your final maps.
Let’s see the steps needed to create a map book.
Create a project
Begin with a classic QGIS project, import your layers and set styles according to your needs.
You have to create a layer containing coverage geometries, which can be any type of geometries, even if polygons are best to represent a coverage. The Atlas plugin will read this layer and for each feature of the layer, will create an output map.
This coverage can have any field number and names.
You can now create a template for your output, in the Quantum GIS composer. The template is a classic composer document. Two things can be noted :
- You have to remind which map item will contain your coverages. You can know the map item name with the tooltip (”Map 0” for example).
- You can use text replacement in label. Every occurence of $FIELD(fieldname) in a label will be replaced by the value of the field with name fieldname from the coverage layer, for the current coverage.
You are now ready to launch the plugin. Find the entry in the plugins menu or click the atlas plugin button. You should see the following dialog.
You have to fill the form before clicking on Render to launch the rendering of the output maps. The options are :
- Coverage layer : The name of the layer containing the coverage geometries
- Hide coverage : If checked, the coverage layer itself will not be rendered on the output map
- Composer template : Choose a template for output images. You can refresh the template list or show the selected template in the composer window
- Composer map object : Item on the composer template where the map extent will be zoomed on each coverage. Use the tooltip over objects in the composer window to know the map item name
- Margin around coverage : Amount of space around given coverage geometry. Default is 10% of coverage bounding box
- Output directory : Location where the rendering writes the output images to
- Filename pattern : Generic name of the output files. The final names will have a _n suffix before the extension, n being the image number (like basename_0.pdf). The pattern extension determines the output file type. The latter can be any image format (PNG, JPG…) or PDF.
- Render : The render button launches the rendering process, writing output in the specified directory
The results are written to the filesystem, with the file type specified in the filename pattern.
For example, PNG output :
We can notice that labels have been replaced by corresponding field values in the coverage layer.
Where is it ?
The plugin has been published on QGIS main plugin repository, just look in QGIS plugin installer. Don’t forget to activate the experimental plugins in QGIS plugin installer’s options.
[Update] : For versions < 1.7.3 you have to manually add the new plugin repository : http://plugins.qgis.org/plugins/plugins.xml
Plugin’s homepage is http://hub.qgis.org/projects/atlas
The code can be obtained at : http://hub.qgis.org/projects/atlas/repository
The bugtracker is there : http://hub.qgis.org/projects/atlas/issues
What’s next ?
This plugin is a first release. While being functional for us, it is a beta prototype. There is still a lot of work needed to be done to have a production-ready tool. We are looking for contributors (code, documentation, bug reports, funding…). We would also be happy to have feedback and a gallery of map books if you can publish them.
If you like the plugin and want some improvement, do not hesitate to contact us, we can develop it for you, or adapt it to your specific needs !