Introduction to QGIS

Quantum GIS (QGIS) is a free and open source software used for viewing, editing, and analysis of geospatial data.

Downloading and installing

1, Go to the download page.

2, Click and download the 3.16 version (most stable).

3, Install it.

4, Click on the QGIS Dektop icon to start the software.

Features

Upon opening the software, you will see the:

  • Menu on the top

  • Toolbar just below

  • Layers panel on the left side

  • Canvas

  • Status bar on the bottom


To see what the icons on the Toolbar are, just hover over them with your mouse.


With a right click, you can see all options of the Panels and Toolbars.


If you click and hold on the three vertical dots, you can also rearrange the tools.

Plugins

Plugins are very useful as they add to the core functionality of the QGIS. These are written by developers and other independent users.

Click Plugins -> Manage and Install Plugins…. Here you will see All, Installed, Not installed plugins and so on.

UI Themes

To change the look of QGIS, click Plugins -> All, search for Load QSS - UI Themes and install it.

Click Plugins -> Load QSS - UI Themes.


Now you can change the colouration of the software.


QuickMapServices

The QuickMapServices plugin gives a wide range of option to choose a basemap.

Click Plugins -> Manage and Install Plugins… -> All and install QuickMapServices.

Then go to Web -> QuickMapServices. Go down to Settings.


Click More services -> Get contributed pack then Save.


Now you have a variety of basemap options.

Note

Prestyled basemaps from providers like Esri, Google or Mapbox are used as foundational layer for maps.

Adding data

Vector data

Adding .csv

Data: World cities

After downloading the file (free version), make sure it is in a folder where you can find it. When extracting it, you will see the worldcities.csv file.

In QGIS:

  • Layer -> Add Layer -> Add Delimited Text Layer

  • For File name add worldcities.csv.

  • In Geometry Definition

    • X field: lng

    • Y field: lat

    • Choose Geomtery CRS

    • Click Add and Close


Change the symbology: Right click -> Properties -> Symbology. Choose dot blue, reduce the size to 0.4 and click OK.


Add a basemap: Web -> QucikMapServices -> CartoDB Dark Matters

You have a map of the world cities.


Adding shapefile

Data: Marine Ecoregions

After downloading the file, make sure it is in a folder where you can find it. When extracting it, you will see that the .shp file is accompanied with six other files. The section on GIS data format explain what these are. (Always make sure that a. shp has these additional files and shared in a zipped format.)

In QGIS:

  • Layer -> Add Layer -> Add Vector Layer

Or via the toolbar on the left, clicking on the first icon.


Click on the downloaded .zip folder or, if the folder was extracted, on the .shp file.

Once the file added, right click on it and Open Attribute Table. You will then see the content of the shapefile.


Next, right click -> Properties -> Symbology then choose Categorised.


Just below for Value choose Ecoregions. Then click Classify then OK.


You have a basic map of the Marine Ecoregions of the world.


Adding GeoJSON

You can add GeoJSON data in the same way. But now instead of downloading it, let’s use the direct URL.

Data: Ocean currents

On the website, click Download Layer -> GEOJSON.

Copy the URL.

In QGIS:

  • Layer -> Add Layer -> Add Vector Layer.

  • Click Protocol: HTTP(S), cloud, etc.

  • Paste the URL then click Add.


Right click on the layer -> Rename Layer to ‘Ocean currents’.

Next, right click -> Properties -> Symbology then choose Categorised. Choose Value: TEMPERTUR then Classify.

If you double click on the line just below Symbol, you can change the colour of the line. Choose red and blue.


You have a map of the warm and cold ocean currents of the world.


Raster data

Data: Sea surface temperature data

Click on Plot data. Click Download on the left and download the NetCDF and GeoTIFF files. (Note: you may need to create a login.)

GeoTIFF

In QGIS:

  • Layer -> Add Layer -> Add Raster Layer.

  • Choose the GeoTIFF file then Add.


  • Right click on the layer then Properties.

  • Choose Symbology then Render type Paletted/Unique values.

  • Choose Color ramp Reds.

  • Click Classify then Apply and OK.


You have a map of the average sea surface temperature from December 2020.


NetCDF

To add the NetCDF file (.nc), follow the exact same steps as for the GeoTIFF.

WMS

Geospatial data served via Web Map Services (WMS) can be both vector and raster, but when received, it is raster data.

Data: Bathymetry

Click and copy or just copy the URL next to WMS.

In QGIS:

  • Layer -> Add Layer -> Add WMS/WMTS Layer.

  • Click New. In Connection Details add a name and paste the URL. Click OK.


  • Click Connect and choose Mean depth on multi colour. Click Add then Close.


You have a map of the bathymetry of the European seas.


External basemap

You can also add external basemap via WMS. For example, a Mapbox basemap layer.

On Mapbox:

  • Sign up to Mapbox.

  • Click Studio and choose New style then Basic.

  • Click Customize basic.

  • Choose Share on the top right.

  • Make the layer public then from the Developer resources choose Third party, WMTS.

  • Copy the URL.


In QGIS:

  • Layer -> Add Layer -> Add WMS/WMTS Layer.

  • Click New. In Connection Details add a name and paste the URL. Click OK.

  • Click Connect, Add then Close.

You have a Mapbox layer as a basemap.

Symbology & labelling

Symbology was touched on before but let’s now look into it more.

Data: Countries

Download the countries shapefile.

In QGIS:

  • Add the shapefile as a vector layer.

  • Right click -> Properties -> Symbology.

  • Choose Categorized -> Value ADM0_A3.

  • Classify then click Apply.


  • Next choose Labelling -> Single Labels.

  • Make the size 5 and click Apply.


  • Next choose Buffer, tick the box next to Draw text buffer and choose size 0.5.


  • Click Apply then OK.

You have a map of the countries with labels.


Tip

Don’t forget to check out the rest of the functions of Symbology and Labels.

Attribute table

Using the same data:

  • Right click on the layer -> Open Attribute Table.

  • The attribute table will show the fields and attribute values.

  • On the top left you will see a set of tools - hover over to see their functions. You can Toggle edit, Select, Invert selection, Diselect, Delete features and so on.


  • Click on one of the rows. You will see that that data point will appear in orange.


  • Right click on one of the attribute fields. You will see that you have the choice to zoom, pan and flash that data point.


  • You have the option to display only the selected row.


Select data

From the toolbar, you can select features, features by polygon, features by freehand and features by radius.



Select by expression (SQL)

You can also select features using expression.


SQL or Structured Query Language is a programming language designed to manage and retrieve data from a specific database.




Create vector data

To create a new shapefile:

  • Layer -> Create layer -> New Shapefile Layer


  • Name the new layer, choose from the Geometry type (point, multipoint, line, polygon), then click OK.


  • Click Toggle Edit then Add Point Feature.


  • Using the crosshair, place three random points. Then click Toggle Edit again to save.


  • Right click -> Export -> Save Feature As to save the file in your preferred format.


Make sure to try and create a line and a polygon shape as well.

Digitising

  • Choose a basemap from the QuickMapServices.

  • Zoom into London, find the River Thames between Blackfriars and Southwark Bridge.

  • Following the steps from above, create a new polygon vector layer.

  • Using the crosshair, draw the polygon following the shape of the river between the two bridges.


  • When finished, right click, OK, then click Toggle Edit to save.


Using this method, you can create a set of geospatial data of objects like river, lake, pond, houses, roads and so on.

Geoprocessing tools

You can access the Geoprocessing Tools via Vector.


Buffer: Computes a buffer area for all the features in an input layer, using a fixed or dynamic distance. (Not covered in this booklet)

Clip: Clips a vector layer using the features of an additional polygon layer. Only the parts of the features in the Input layer that fall within the polygons of the Overlay layer will be added to the resulting layer.

  • Open this shapefile and add to QGIS.

  • Vector -> Geoprocessing Tools -> Clip

  • Choose the polyline as the input layer and the polygon as the overlay layer. Name the clipped shapefile. Press Run.


  • The clipped layer should appear.


Convex hull: Calculates the convex hull for each feature in an input layer. (Not covered in this booklet)

Difference: Extracts features from the Input layer that fall outside, or partially overlap, features in the Overlay layer.

  • Using the above files: Vector -> Geoprocessing Tools -> Clip

  • Choose the polyline as the input layer and the polygon as the overlay layer. Name the difference shapefile. Press Run.


  • The difference layer should appear.


Dissolve: Takes a vector layer and combines their features into new features. (Not covered in this booklet)

Intersection: Extracts the overlapping portions of features in the Input and Overlay layers. (Similar to the Clip tool)

Symmetrical difference: Extracts the portions of features from both the Input and Overlay layers that do not overlap. (Not covered in this booklet)

Union: Checks overlaps between features within the Input layer and creates separate features for overlapping and non-overlapping parts.

Eliminate selected polygons: Combines selected polygons of the input layer with certain adjacent polygons by erasing their common boundary. (Not covered in this booklet)

Data management tools

You can access the Data Management Tools via Vector.


Create Spatial Index: Create a spatial index for OGR- supported formats. (Not covered in this booklet)

Join attributes by location: Join additional attributes to vector layer based on spatial relationship. Attributes from one vector layer are appended to the attribute table of another layer and exported as a shapefile. (Not covered in this booklet)

Merge Vector Layers: Merge several shapefiles within a folder into a new shapefile based on the layer type (point, line, area).

  • Open the above digitised file. Following the steps above, digitise the area of the Thames between Southwark and London Bridge.


  • Vector -> Data Management Tools -> Merge vector Layers.

  • From the Input layers choose both shapefiles, set the CRS and save the file. Then click Run.


  • You should have the new merged layer appear.


Reprojecting Layer: It creates a new layer with the same features as the input one, but with geometries reprojected to a new CRS. (Not covered in this booklet)

Split vector layer: Split input layer into multiple separate layers based on input field. (Not covered in this booklet)

Georeferencing

Image: World Topology and Bathymetry

Right click on the image then Save image as….

In QGIS:

  • First add a basemap: Web -> QuickMapServices -> CartoDB Positron.

  • Then: Raster -> Georeferencer -> File -> Open Raster.

  • Click Add Point. You will see a crosshair appear as your cursor.


  • Zoom in and find an easily identifiable location (e.g. tip of Florida). Click on it.

  • A window will appear to enter the map coordinates. Click From Map Canvas.


  • QGIS will take you back to the basemap. Choose the same point on your basemap (tip of Florida) then click OK.

  • Repeat the same steps on two more locations (e.g. tip of India and Tasmania).

  • Click Start Georeferencing. It may ask you for Transformation Settings.


  • Choose Linear, Nearest neighbour, EPSG:3857. The Output raster will be placed into the same folder as the original. Click OK.


  • Click again Start Georeferencing.

  • The new georeferenced picture should appear in the folder where the original is stored.

  • Click File -> Close georeferencer.

  • Add the georeferenced image as raster.

You have a georeferenced image on top of the basemap.

Web map

Install the plugin called qgis2web.

Using the world cities data, make the same map. Rename the layer to World cities and adjust symbol size to 1.

Web -> qgis2web -> Create web map.

Under Layers and Groups tab, tick the box next to Cluster.

Under Appearance tab, Add layers list Expanded. Tick boxes next to Geolocate user, Highlight on hover and Show popups on hover. Template is Full screen and Extent Fit to layers extent.

Under Export tab, chose Export to folder then using the chose an export folder.

Also, choose Leaflet.

An interactive map should appear in your default browser. Hover over the blue dots or click on the clusters to zoom in.

Reprojecting

Data: Countries

Download the countries shapefile.

In QGIS:

  • Add the shapefile as a vector layer.

  • Right click on the layer -> Export -> Save Feature As….


  • Format: ESRI Shapefile

  • Choose a file name and using the choose a folder to save to.

  • A new window will pop up. Search for the Winkel projection.

  • Click World_Winkel_Tripel_NGS and click OK.


  • Remove both layers.

  • Re-add the new layer (Winkel projection).

You have a map of the world (Winkel projection).