The systematic sampling design is ready and the field teams have loaded the GPS coordinates in their navigation devices. They also have a field data form where they will collect the information measured at every sample plot. To easier find their way to every sample plot, they have requested a number of detail maps where some ground information can be clearly seen along with a smaller subset of sample plots and some information about the map area. You can use the Atlas tool to automatically generate a number of maps with a common format.
The goal for this lesson: Learn to use the Atlas tool in QGIS to generate detailed printable maps to assist in the field inventory work.
Before we can automate the detailed maps of the forest area and our sampling plots, we need to create a map template with all the elements we consider useful for the field work. Of course the most important will be a properly styled but, as you have seen before, you will also need to add lots of other elements that complete the printed map.
Open the QGIS project from the previous lesson forest_inventory.qgs. You should have at least the following layers:
Save the project with a new name, map_creation.qgs.
To create a printable map, remember that you use the Composer Manager:
Set up the printer options so that your maps will suit your paper and margins, for an A4 paper:
In the Print Composer window, go to the Composition tab (on the right panel) and make sure that these settings for Paper and quality are the same you defined for the printer:
Composing a map is easier if you make use of the canvas grid to position the different elements. Review the settings for the composer grid:
You need to activate the use of the grid:
Now you can start to add elements to your map canvas. Add first a map element so you can review how it looks as you will be making changes in the layers symbology:
Notice how the mouse cursor snaps to the canvas grid. Use this function when you add other elements. If you want to have more accuracy, change the grid Spacing setting. If for some reason you don’t want to snap to the grid at some point, you can always check or uncheck it in the View menu.
Leave the composer open but go back to the map. Lets add some background data and create some styling so that the map content is as clear as possible.
As you can see the background map is already styled. This type of ready to use cartography raster is very common. It is created from vector data, styled in a standard format and stored as a raster so that you don’t have to bother styling several vector layers and worrying about getting a good result.
The current styling of the sample plots is not the best, but how does it look in the map composer?:
While during the last exercises, the white buffer was OK on top of the aerial image, now that the background image is mostly white you barely can see the labels. You can also check how it looks like on the composer:
Obviously this is not good enough, you want to make the plot numbers as clearly visible as possible for the field teams.
You have been working in Module: Creazione di una Mappa di Base with symbology and in Module: Classifying Vector Data with labeling. Go back to those modules if you need to refresh about some of the available options and tools. Your goal is to get the plots locations and their name to be as clearly visible as possible but always allowing to see the background map elements. You can take some guidance from this image:
You will use later the the green styling of the forest_stands_2012 layer. In order to keep it, and have a visualization of it that shows only the stand borders:
Now you have two different visualizations of the forest stands and you can decide which one to display for your detail map.
Go back to the Print composer window often to see what the map would look like. For the purposes of creating detailed maps, you are looking for a symbology that looks good not at the scale of the whole forest area (left image below) but at a closer scale (right image below). Remember to use Update preview and Set to map canvas extent whenever you change the zoom in your map or the composer.
Once you have a symbology your happy with, you are ready to add some more information to your printed map. Add at least the following elements:
You have created a similar composition already in Module: Creazione di Mappe. Go back to that module as you need. You can look at this example image for reference:
Export your map as an image and look at it.
That is what it will look like when printed.
As you probably noticed in the suggested map template images, there are plenty of room on the right side of the canvas. Lets see what else could go in there. For the purposes of our map, a legend is not really necessary, but an overview map and some text boxes could add value to the map.
The overview map will help the field teams place the detail map inside the general forest area:
Notice that your overview map is not really giving an overview of the forest area which is what you want. You want this map to represent the whole forest area and you want it to show only the background map and the forest_stands_2012 layer, and not display the sample plots. And also you want to lock its view so it does not change anymore whenever you change the visibility or order of the layers.
Now your overview map is more what you expected and its view will not change anymore. But, of course, now your detail map is not showing anymore the stand borders nor the sample plots. Lets fix that:
Notice that only the bigger map is displaying the current map view, and the small overview map is keeping the same view you had when you locked it.
Note also that the overview is showing a shaded frame for the extent shown in the detail map.
Your template map is almost ready. Add now two text boxes below the map, one containing the text ‘Detailed map zone: ‘ and the other one ‘Remarks: ‘. Place them as you can see in the image above.
You can also add a North arrow to the overview map:
The basic map composer is ready, now you want to make use of the Atlas tool to generate as many detail maps in this format as you consider necessary.
The Atlas coverage is just a vector layer that will be used to generate the detail maps, one map for every feature in the coverage. To get an idea of what you will do next, here is a full set of detail maps for the forest area:
The coverage could be any existing layer, but usually it makes more sense to create one for the specific purpose. Let’s create a grid of polygons covering the forest area:
The new polygons are covering the whole forest area and they give you an idea of what each map (created from each polygon) will contain.
The last step is to set up the Atlas tool:
That tells the Atlas tool to use the features (polygons) inside atlas_coverage as the focus for every detail map. It will output one map for every feature in the layer. The Hidden coverage layer tells the Atlas to not show the polygons in the output maps.
One more thing needs to be done. You need to tell the Atlas tool what map element is going to be updated for every output map. By now, you probably can guess that the map to be changed for every feature is the one you have prepared to contain detail views of the sample plots, that is the bigger map element in your canvas:
Now you can use the preview tool for Atlas maps to review what your maps will look like:
Note that some of them cover areas that are not interesting. Lets do something about it and save some trees by not printing those useless maps.
Besides removing the polygons for those areas that are not interesting, you can also customize the text labels in your map to be generated with content from the Attribute table of your coverage layer:
You can go back to the Print Composer and check that the previews of the Atlas use only the polygons you left in the layer.
The coverage layer you are using does not yet have useful information that you could use to customize the content of the labels in your map. The first step is to create them, you can add for example a zone code for the polygon areas and a field with some remarks for the field teams to have into account:
The forest manager will have some information about the area that might be useful when visiting the area. For example, the existence of a bridge, a swamp or the location of a protected species. The atlas_coverage layer is probably in edit mode still, add the following text in the Remarks field to the corresponding polygons (double click the cell to edit it):
Almost ready, now you have to tell the Atlas tool that you want some of the text labels to use the information from the atlas_coverage layer’s attribute table.
Test the contents of the label by looking at the different Atlas preview maps.
Do the same for the labels with the text Remarks: using the field whit the zone information. You can leave a break line before you enter the expression. You can see the result for the preview of zone 2 in the image below:
Use the Atlas preview to browse through all the maps you will be creating soon and enjoy!
Last but not least, printing or exporting your maps to image files or PDF files. You can use the Atlas ‣ Export Atlas as Images... or Atlas ‣ Export Atlas as PDF.... Currently the SVG export format is not working properly and will give a poor result.
Lets print the maps as a single PDF that you can send to the field office for printing:
Open the PDF file to check that everything went as expected.
You could just as easily create separate images for every map (remember to uncheck the single file creation), here you can see the thumbnails of the images that would be created:
In the Print Composer, save your map as a composer template as forestry_atlas.qpt in your exercise_data\forestry\map_creation\ folder. Use Composer ‣ Save as Template. You will be able to use this template again and again.
Close the Print Composer and save your QGIS project.
You have managed to create a template map that can be used to automatically generate detail maps to be used in the field to help navigate to the different plots. As you noticed, this was not an easy task but the benefit will come when you need to create similar maps for other regions and you can use the template you just saved.
In the next lesson, you will see how you can use LiDAR data to create a DEM and then use it to your enhance your data and maps visibility.