Adding raster data in context

“Raster data consists of a matrix of cells where each cell represents a specific value on the earth surface. QGIS can read and write different types of raster formats.”

QGIS used the library called GDAL to read and write various formats. Rasters are commonly used for making base maps, remote sensing analysis ie XYZ tiles in QGIS all render raster data. In this module, we will explore the various methods available for loading raster data.

You try:

Goal: To explore how to load raster data in QGIS

  • Navigate to the exercise folder.
  • Look at the two raster layers in the folder noting their file extensions. If you do not see the extensions you need to change the folder preferences on your machine.
  • Navigate to Add Raster Layer on the Manage Layers Toolbar or Layers menu >Data Source manager
  • Navigate to the exercise folder and select the raster layer people_allow_resampling_true.tif.

Note the extensions of all the layers in the folder.
Why did you select the extension .tif?

Method B

  • Select the Browser panel from the View >Panels menu.
  • Dock the Browser panel if you haven't already done so.
  • Use the browser panel to navigate to the exercise folder.
  • Right-click on the layer people_allow_resampling_true and click add a layer to map canvas.
  • Select the layer classified_raster_landcover and drag it onto the map canvas.
  • How many layers are now visible in your layer list?
  • In the exercise folder there is a file called raster-data.gpkg. Can you explore this file and see if it is possible
    to load the contents into QGIS. What type of file is it?

More about raster data in QGIS

Raster data is cell-based and this data category also includes aerial and satellite imagery. Raster data is grouped into two categories continuous and discrete. Example of discrete raster data is population density whilst continuous data examples are temperature and elevation. Whilst loading data it QGIS it is important to filter the data based on the extensions. The most common format of raster data is geotiff that can have an extension .tif/.TIFF/.tiff. Loading layers using the browser panel has significant advantages because it automatically filters for the correct format to be loaded in QGIS. A raster layer can also have supporting files which we saw in the exercise folder. A typical layer can have the following files associated with it.

File Extension Explanation
.prj A file with projection definition for the layer
.qml QGIS specific file that has information about how the raster should look like. (Symbology)
aux.xml A file with raster statistics
.xml Metadata file describing the characteristics of the raster

Check your knowledge:

  1. An image taken with the camera on your phone is classified as a raster or not.:

    1. No it is not
    2. Yes it is
  2. What is one distinct advantage of adding raster layers using the browser panel:

    1. It is generally faster than the convectional method
    2. It automatically filters the layer only showing you the extension that can be loaded in QGIS
    3. You can load all the layers that are in the folder and test which one is the correct raster
  3. Can raster layers be stored in a database:

    1. No, Raster layers are sometimes big and cannot fit in a database.
    2. Yes, this will enhance analysis as vector and raster operations can be easily combined