Mapping Waste Disposal Volumes (QGIS3)

This tutorial is designed to help you discover new mapping techniques and cartographic tools available in QGIS.

Overview of the task

You will learn how to take point data of landfills and create a proportional-symbol map showing amount of waste processed at each landfill.

../../_images/output5.png

Other skills you will learn

  • Importing ArcGIS server data in QGIS using REST URL.

  • Importing tabular data from spreadsheets in QGIS.

Get the data

You can find the data for the tutorial from Cape Town Open Data Portal - https://odp-cctegis.opendata.arcgis.com. We will be importing data from the portal using ArcGIS Online REST service and will be preparing three layers mentioned below.

  1. Wards: A polygon shapefile with ward boundaries of Cape Town.

  2. Landfill Sites: A point shapefile with current, closed and proposed waste processing facilities in Cape Town.

  3. Waste Disposal Data: A spreadsheet with amount of waste entering City disposal facilities.

Let’s see the step wise to prepare the dataset for this tutorial.

  1. Go to the Data Portal - https://odp-cctegis.opendata.arcgis.com/search?tags=. We will search for the Wards data in the search bar and click to browse further.

    ../../_images/db111.png
  2. Click on View Full Details to explore services available to get the data.

    ../../_images/db26.png
  3. Scroll down to find View Data Source open and click on the it.

    ../../_images/db32.png
  4. On the ArcGIS REST Services Directory, go to Home and copy the URL of that page. The copied looks like - https://citymaps.capetown.gov.za/agsext1/rest/services.

    ../../_images/db42.png
  5. Now, open QGIS and go to Open Data Source Manager.

    ../../_images/db52.png
  6. The list of data sources is seen in the left panel. Scroll down to find ArcGIS REST Server. Click on new to create new server connection.

    ../../_images/db61.png
  7. In the Connection Details, give the Name Cape Town Open Data Portal and paste the copied url as an input for URL.

    ../../_images/db71.png
  8. Click OK and then Connect to see the data folders available in the server.

    ../../_images/db81.png
  9. Now we will search for all three layers required for the tutorial from the database. Firstly, we will open Wards layer in the QGIS. Expand folders to browse to the layers. Full path to the layer is - Theme_Based ‣ Open_Data_Service ‣ Ward. Select the layer and click Add.

    ../../_images/db91.png
  10. Let’s open Landfill sites in QGIS. Full path to the layer is Theme_Based ‣ Open_Data_Service ‣ Landfill Sites And Refuse Transfer Stations. Select the layer and click Add.

    ../../_images/db101.png
  11. Now we will search for the Waste Disposal spreadsheet on the data portal. Click on the Waste Disposal data link to download the file.

    ../../_images/db112.png
  12. The file named Waste Disposal September 2023.ods will be downloaded after clicking on the link. Open the file. The file contains 3 sheets out of which we will be using Disposal_per_Site data for the tutorial.

    ../../_images/db121.png
  13. We will keep only the total disposal per site. Add a new sheet named Disposal_per_Site_edited and copy the data from Disposal_per_Site sheet. Edit the site names by removing the brackets to match the attributes of Landfill sites data. The values are formatted numbers, change it to simple decimals. Save it as waste_disposal_september2023.ods in a data folder for this tutorial.

    ../../_images/db131.png
  14. Observe that there are 3 different sites for Bellville and disposal value is zero for two of them. Let’s combine it to keep the only Bellville site with the non-zero value.

    ../../_images/db141.png
  15. Switch to QGIS. We have already imported the shapefiles from ArcGIS server. Let’s save it in the local data folder for this tutorial. Right-click on the Landfill Sites And Refuse Transfer Stations layer. Go to Export ‣ Save Features As.

    ../../_images/db151.png
  16. In the Save Vector Layer as dialog, navigate to the data folder and save the shapefile as landfill_sites.shp. Click OK.

    ../../_images/db161.png
  17. Similarly, save the ward layer as wards.shp in the data folder. Now we have prepared the data folder with all three layer and ready to start with the procedure.

    ../../_images/db171.png

For convenience, you may directly download a copy of these files below:

Wards.shp

landfill_sites.shp

waste_disposal_september2023.ods

Procedure

  1. Open QGIS. Click Open Data Source Manager icon to add the layer.

    ../../_images/1157.png
  2. Switch to Vector tab and navigate to the data folder and select wards.shp and landfill_sites.shp files. Click Add.

    ../../_images/2131.png
  3. Open the Attribute Table of the landfill_sites layer. This layer contains all solid waste collection sites in Cape Town. You can see that the STATUS attribute contains whether the facilities are operational or not. We can use the values in this column to select only the Current facilities.

    ../../_images/369.png
  4. Right-click the landfill_sites layer and select Filter.

    ../../_images/440.png

5. In the Query Builder, enter the following expression and click OK. "STATUS" = 'Current'

../../_images/536.png
  1. Once the filter is applied, only a subset of point will be visible on the map. Next we will add the waste_disposal_september2023.ods file. Click on the Open Data Source Manager icon and switch to Vector tab. Navigate the file by clicking on … button given beside File name. Click Add.

    ../../_images/635.png
  2. In the Select Items to Add dialog, select Disposal_per_Site_edited item and click Add Layers.

    ../../_images/735.png
  3. Open the attribute table of waste_disposal_september2023 layer. This table has the name of the facility and total waste collected at the site for the month of September 2023.

    ../../_images/834.png
  4. Let’s join this table with the landfill_sites points layer. Go to Processing ‣ Toolbox from the menubar.

    ../../_images/935.png
  5. Search and locate the Join attributes by Field Value tool from the toolbox. Double-click to open it.

../../_images/1041.png

11. In the Join Attributes by Field Value dialog, select landfill_sites as the Input layer and NAME as the Table field. Select waste_disposal_september2023 as the Input layer 2 and Disposal Site as the Table field 2. Check the Discard records which could not be joined box. Save the Joined layer by clicking on … button and select Save to File.

../../_images/1158.png
  1. Name the output layer as waste_by_station_september_2023.shp and click Run.

../../_images/1244.png
  1. Once the processing finishes, a new layer waste_by_station_september_2023 will be added which will have the amount of waste in the Sept2023 column.

../../_images/1342.png
  1. Now let’s visualize this data. First select the Wards layer and click on Open the Layer Styling panel icon.

../../_images/1438.png
  1. Set the symbology of this layer to Single Symbol with a light Fill color and Stroke color.

../../_images/1533.png
  1. Next select the waste_by_station_september_2023 layer and select Simple Marker symbol. Click the drop-down for Symbol layer type.

../../_images/1631.png
  1. Select Filled Marker as the Symbol layer type. We will now change the size of the symbol proportional to the amount of waste collected at the site. To do this, we must apply a Data-defined Override - which can apply a field value or expression to calculate the size for each feature. Click the Data-defined Override button next to Size and select Assistant.

../../_images/1732.png
  1. We want to size the filled symbols based on values of collected waste. Select Sept2023 field as Source. Set values from 5000 to 50000. Now set the size of circle from 1 to 25. Click on the Back icon.

../../_images/1827.png
  1. You will see the circles of different size for each point. The sizes are in Millimeters unit. The data-defined override button will turn yellow indicating that an override is applied for that value.

../../_images/1922.png
  1. Let’s explore more advanced styling options. Change the Symbol layer type to Shapeburst Fill. Select 2 colors of your choice to render the circles with a gradient fill.

../../_images/2020.png

21.Next we will apply a Drop-shadow effect to the circles to make them pop-out on the map. These are known as Live Layer Effects. Scroll down and expand the Layer Rendering section. Check the Draw effects button and click the star button.

../../_images/2132.png
  1. Enable the Drop Shadow option.

../../_images/2221.png
  1. The map looks pretty good now, but the reader needs to know what values these symbols represent. It will be good to have an interpretable legend. Click Back button till you are back in the main Layer Styling dialog. Select Marker and click on the Advanced button at the bottom. Select Data-defined Size Legend.

../../_images/2318.png
  1. Enter Waste Collected (Tonnes) as the Title and click the + button to add legend entries. Since our symbols are scaled by a factor of 3, enter the appropriate value and Label. You will see a nice legend now appear in the Layers panel. The same legend will be available in the Print Layout if you wished to create a map from this data.

../../_images/2418.png
  1. Close the Layer styling panel. The visualization is ready. You learnt how to turn a data in a table to a visually informative and attractive map.

../../_images/2517.png

If you want to give feedback or share your experience with this tutorial, please comment below. (requires GitHub account)