Exploring Italian vector data with QGIS

From Open source mapmaking technologies
Jump to: navigation, search

To start mapping with QGIS, we will explore the administrative limits of Italy.

The administrative areas are organized in three levels. We will open and explore the third level, the most detailed one.

Module data

The Administrative Divisions were downloaded from Global Administrative Areas.

You can download Italy Administrative divisions from GDA:

  • Select Italy
  • Select the Geopackage file format

Alternatively, you can downloaded a copy from http://mapmaking.info/images/files/ITA_adm_gpkg.zip.

We will play with the Administrative divisions of Italy.

After download the archive, go to the Downloads folder and extract the files there. We will use the extracted ITA_adm.gpkg file.

Other source of global data


Introducing QGIS

Start QGIS from the Geospatial menu, under Desktop GIS.

You will be presented with a random QGIS Tip. Get rid of the tips, by selecting the check box on the bottom of the dialog. You can activate the QGIS Tips again, going to Settings → Options → General.

Adding administrative limits data

To add the first data set to QGIS, drag and drop CHN_adm.gpkg on top of QGIS (CHN_adm.gpkg is locate in the Downloads folder). Just drop it on top of QGIS.

A new dialog will open, so you can select which layers to add to QGIS. There are more than one layer available. Select them all.

Select china adm layers to add.png

The result will be a new map, with 4 layers.

Qgis with china adm layers.png

Start by deselecting layers:

  • CHN_adm CHN_adm0 any
  • CHN_adm CHN_adm1 any
  • CHN_adm CHN_adm2 any

Keep only the layer ITA_adm ITA_adm3 selected. We will work with this layer.

Qgis with chine adm layer 3.png

Your polygons have a different color? Don't worry. The data set does not have any information about styling. QGIS uses a random color to fill the polygons in such case.

Explore the interface

Before any further exploration, it will be easier for us, to call the same name to each QGIS interface area.

Let's use the following terminology:

Qgis interface.png

  1. Menu bar
  2. Toolbars (can be placed in different places)
  3. Layer panel
  4. Browser panel
  5. Map canvas
  6. Status bar

Toolbars also have names. The ones we need the most are:

Map navigation toolbar Map navigation toolbar.png
Attributes toolbar Attributes toolbar.png
Manage Layers toolbar Manage Layers toolbar.png

Note: Each panel or toolbar can be moved, activated or deactivated individually. But if you are completely lost and want to restore the original layout, close QGIS, and write on the Terminal Emulator:

rm -rf .config/QGIS .qgis2

Start QGIS again.

Map navigation

Zoom, in, zoom out, zoom to extend

Identify features

Selecting and deselecting features

In GIS, each layer is composed by a set of features with common properties.

Some GIS operations are performed at the layer level, dealing with all features. But sometimes we just want to manipulate a subset of features. To accomplish this, we can create a set of selected features. Features can be added or removed from the selected set.

It is important to learn how to create and manage the selected set.

Explore the data

The layer as features, each with a geometry property (a polygon, in this case) and several additional attributes. When we used the Identify Tool, we could see each feature attributes.

Many operations are performed based on the attributes of each feature. Select Open Attribute Table from the context menu, on top of the layer name.

Filtering features

Instead of display all features, QGIS let you see only filtered features.

NAME_1 = giulia

The title bar provides valuable numbers:

Total features: 8100, filtered: 219, selected: 0.

Selecting features

Features can be selected in the table view.

First, filter features having NAME_1 = giulia

219 features will be displayed.

Order them by NAME_2.

Select those having NAME_2 = Trieste.

Explore the table view toolbar

Move selection to the top

Zoom to the selected features.

Managing the selection

Certain operations can be done with the selected elements.

Dissolve municipality limits

We want to create a new polygon of the Trieste province by dissolving the 6 municipalities of the Trieste province.

The 6 municipalities should be already selected.

Vector → Geoprocessing tools → Dissolve

Dissolve wuhan districts.png

Save it as trieste.shp.

OK, than Close.

A new layer is displayed on the map canvas, and a new item is displayed on the layer panel, on top of ITA_adm ITA_adm3.

Saving the selection

We will need to work with the Wuhan districts, but not with all districts in China. Instead of working with all districts, we create a new shapefile with the only 5 districts we need in more advanced exercises.

Confirm that you still have the 5 districts of Wuhan area selected.

On the layer panel, over the china-adm-3 layer, use the context menu to select "Save Selection As..."

Save selection as.png

One more entry is added to our layer list, on top of china-adm-3.

Managing layers

We already have 3 layers. Layers can by grouped and ordered for better organization. The order is also important to define the rendering order.

Drag the china-adm-3 layer to the top, and see whats happen. The two other layers became invisible.

Create group layers

Use the contextual menu in the layer panel to "Add New Group". Change it's name from group1 to China.

Create another group. Call it Wuhan.

Drag the layers, to create the following hierarchy:

Wuhan wuhan-district wuhan China china-adm-3

Layer order.png


Making beautiful maps is an art. Let's start by exploring some basic styling capabilities.

Change the style of the three layers.

  • china-adm-3: use some sort of (pastel) green.
  • wuhan: use a more vivid green
  • wuhan-district: do not fill the polygons; select No Brush, in the Fill Style combobox.
  • wuhan-district: in the labels panel, check 'Label this layer with' and select NAME_3 from the dropdown list.


Over the wuhan-district or wuhan layer, select Zoom to Layer Extent.

The resulting map should look like the following one.

Three layers map.png

Managing projects

Save the project, as qgisintro. Next time, we can reopen this project.