Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Numberedheadings
number-formatdecimal
skip-headingsHNaN
start-numbering-with5
h1[h1.decimal].
h2[h1.decimal].[h2.upper-latin]
h3
h4
h5
enabledtrue
h6
start-numbering-atH1

Raster Data in QGIS

Raster data is fundamentally different from vector data - vector data has discrete features constructed from vertices, while raster data is a digital image, where the content comprises pixels, with a single numeric value from 1 to 255 for each pixel.

File Types

QGIS supports around 100 raster data formats - as with vector data, QGIS uses GDAL for file conversion, so formats supported by GDAL are supported by QGIS.

Loading Raster Images

Load single rasters

  1. Open a new QGIS project

  2. Click Open Data Source Manager > Raster

  3. Browse to ...\QGIS Training\Data\raster\OS_250k\ST.tif and add it to the project

  4. Zoom in until the scale looks appropriate - this should be around 1:250,000

  5. Look at the legend for the layer in the Layers panel - you will see that a different colour has been allocated to each of the possible 255 pixel values, so that the image is visualised as a map

  6. Right-click > Symbology to see how this has been done - you can change the symbology, though in this case you shouldn’t need to

  7. In the Transparency tab of the Layer Properties, change the Global Opacity setting - this can be useful if you want a more subtle background map

  8. The Identify Features tool will give you the value and coordinates of each pixel - activate this and click on the image to get values for a single pixel

The image you have loaded will only be useful within a restricted range of scales. We can now load further data which will be more appropriate for larger scales.

Load multiple rasters

  1. In the Data Source Manager, browse to ...\QGIS Training\Data\raster\OS_OpenMap_Local

  2. Using Ctrl-click, select four images with the same ST number - for example:

  3. Click Open then Add to add them to the map

  4. Zoom to one of the images, then zoom to an appropriate scale - around 1:10,000

  5. Add a Group in the Layers panel and put the four new images in it, so they can be turned on and off together

  6. Set the scale for the map to 1:50,000, then go to the Rendering tab for one of the 1:10,000 layers and turn on Scale Dependent Visibility

  7. Under Minimum, use the Set to current canvas scale button to set the 1:10,000 layer to turn on at scales smaller than the current scale

  8. Go back to the map and zoom in and out to see this in operation - change the scale dependencies if necessary

Digital Terrain Model (DTM) Rasters

If you have raster data where pixel values represent elevation, for example the UK Environment Agency LIDAR DTM data, you can use it to visualise landscape, and also to generate values such as slope and aspect.

Load DTM raster

  1. Open the OSM Standard layer from QuickMapServices (Web > QuickMapServices > OSM > OSM Standard)

  2. Add ...\QGIS Training\Data\raster\EA_1m_DTM\lulworth_cove_dtm.tif to the map - this is the Digital Terrain Model (DTM) for Lulworth Cove on the south coast of England

  3. Use the Identify Features tool to click on the image to see the elevation values it contains

  4. To apply some more useful styling, go to Symbology for the layer and set the Render type to Singleband pseudocolor

  5. Under Color ramp, click the dropdown to the right and choose Create new color ramp..., then in the dropdown select Catalog: cpt-city which includes a variety of categorised colour ramps

  6. Go to Topography in the list on the left and select Elevation and click OK

  7. Click Classify to apply the colour ramp - you should be seeing something like this:

  8. Try some other color ramps if you have time

There are a number of inbuilt process in QGIS which will visualise or process the data in different ways.

Hillshade simulates the effect of sunlight on a landscape, providing a more realistic view of the raster.Apply

Create hillshade

to raster

from DTM

  1. Go to Raster > Analysis > Hillshade

  2. Make sure the Lulworth Cove layer is set as the input layer, and leave the other defaults in place

  3. Click Run - you will see a new layer like this:

  4. Put this together with the DTM layer to see the Hillshade layer through the DTM

  5. Ensure the DTM is the first layer in the list

  6. In the Symbology properties for the DTM layer, go to Layer Rendering > Blending mode and select Multiply

  7. The result should be similar to the following:

  8. If you have time, do the same thing using the OSM Standard layer instead of the DTM layer on top of the Hillshade layer

Loading Web Map Services (WMS)

OGC Web Map Service (WMS) is a standard protocol for serving raster data (e.g. map and aerial images) over the Internet. To use a WMS you will need to know the URL of the service, and possibly logon credentials - if you have a relationship with a data provider, they will give you this - otherwise you will find plenty of WMS URLs on the Internet. https://www.data.gov.uk is one source - you can apply a format search for WMS. but be aware that not all WMS sources on the site are live.

Load WMS rasters

  1. To connect to a WMS data source, you will need the to add the connection

  2. In the Data Source Manager, go to the WMS/WMTS tab and click New

  3. In the Create a New WMS/WMTS Connection dialog, enter the details as shown in the screenshot, with https://maps.carlisle.gov.uk/getows.ashx?mapsource=CCC/Inspire as the URL

  4. Click OK then Connect to see a list of available layers

  5. Click on the layer you want to load - for example county_wildlife_sites, then Add

  6. When the layer is loaded, click Close

  7. The WMS raster layer will appear on the map

  8. For more details on individual features, activate Identify Features and click on a feature - many WMS sources will use a GetFeatureInfo to return attribute data on the feature, as in the screenshot below

  9. If you have time, try another WMS source - for example the BGS Radon data at https://map.bgs.ac.uk/arcgis/services/GeoIndex_Onshore/radon/MapServer/WmsServer