Creating a Landuse Map (QGIS3)

Zoning designations define and regulate what kinds of uses are allowed on specific parcels and outline design and development requirements and guidelines. In this tutorial you will learn how to access parcel datasets, style them according to zoning attributes and create a map.

Overview of the task

You will work with a land parcels dataset with zoning information and create a map showing zoning pattern across the CBD region of Cape Town.

../../_images/zoning_map.png

Other skills you will learn

  • How to access and download data from ArcGIS REST in QGIS.

  • How to extract features from a layer that intersect a boundary layer.

  • How to merge different sub-categories from Categorized renderer.

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 REST server URL and will be preparing three layers mentioned below .

  1. Zoning layer: A polygon shapefile with zoning code and description for land parcels having a single zoning - clipped to the Cape Town CBD area.

  2. Split-zoning layer: A polygon shapefile with zoning code and description for land parcels having multiple zoning - with each polygon split into single zones polygons.

  3. Cape Town CDB Area: A polygon demarcating the Cape Town CBD area.

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/. We will search for the Cape Town CBD data in the search bar and click to browse further.

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

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

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

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

    ../../_images/db5.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/db6.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/db7.png
  8. Click Ok and then Connect to see the data folders available in the server.

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

    ../../_images/db9.png
  10. Close the Data Source Manager to see the layer added to the QGIS. Click on Zoom to Layer to centre and display the layer on the canvas.

    ../../_images/db10.png
  11. Now, will add the Zoning layer using Data Source Manager.Connect to Cape Town Open Data Portal and browse to Zoning layer. The full path is Theme_Based ‣ Open_Data_Service_Zoning ‣ Zoning. This is a very large layer, so make sure to check the box Only request features overlapping the current view extent to avoid loading all the features available in the layer. If you forget this, loading of the layer may take a long time. Click Add to open in the QGIS.

    ../../_images/db11.png
  12. Similarly add Split_Zoning layer. The full path is - Theme_Based ‣ Land_Parcel_Zoning ‣ Split Zoning.

    ../../_images/db12.png
  13. We can see all three source layers are open in QGIS. We want to clip the Zoning and Split Zoning layers to the Cape Town CBD boundary layer. Firstly, let’s save all three layers locally as shapefiles. Right click on the Cape Town CBD layer. Look for Export and click on Save Features As.

    ../../_images/db13.png
  14. Set the format ESRI Shapefile and browse to the local folder where you want to save the shapefiles. We will save all the layers related to this tutorial in a single data folder. Save the layer as cbd. Keep all other options default and click OK. Similarly export other two layers as Zoning.shp and Split Zoning to the same folder.

    ../../_images/db14.png
  15. Remove the layers loaded from server. Select all three layers, and click on Remove Layer/Group icon. We want to extract features from Zoning and Split Zoning layers intersecting with cbd boundary.

    ../../_images/db15.png
  16. Go to Processing ‣ Toolbox from the menubar.

    ../../_images/db16.png
  17. In the toolbax, search for Intersection algorithm and double-click to open.

    ../../_images/db17.png
  18. Select Zoning as Input layer and cbd as Overlay layer. Keep other options default and proceed to save output to file.

    ../../_images/db18.png
  19. Save the output layer as zoning_cbd in the data folder and click Run.

    ../../_images/db19.png
  20. Depending on your Processing settings, you will see some errors or warnings displayed in Log tab. The input layer has some invalid geometries and it is being skipped while running intersection. We will fix geometries of Zoning and Split Zoning layers before taking the intersection to extract all geometries.

    ../../_images/db20.png
  21. Remove the intersection output from QGIS and data folder. Search for Fix geometries tool in the processing toolbox. Double-click to open.

    ../../_images/db21.png
  22. Select Zoning as Input layer. Keep all the other inputs as default and save the output layer as zoning_fixed.shp in the data folder by clicking Save to File. Click Run. Repeat the process for fixing geometries on Split Zoning layer and save the layer with fixed geometries as split_zoning_fixed.shp.

    ../../_images/db22.png
  23. Remove Zoning and Split Zoning layers. We will move ahead with extracting features from zoning_fixed and split_zoning_fixed layers which intersect cbd. Search for Intersection from the processing toolbox and double-click to open.

    ../../_images/db23.png

24.Select Zoning_fixed as Input layer and cbd as Overlay layer to perform intersection as described in steps 18 and 19. Save the output as zoning_cbd and repeat the same for split_zoning_fixed layer and save the output layer as split_zoning_cbd.

../../_images/db24.png

For convenience, you may directly download a copy of all three pre-processed layers from the links below:

cbd.shp

zoning_cbd.shp

split_zoning_cbd.shp

Procedure

  1. Open QGIS. Click Open Data Source Manager icon to add layers to work on for the tutorial.

../../_images/180.png
  1. Switch to the Vector tab and use the browsing button to navigate to the folder where you have kept the processed shapefiles.

../../_images/240.png
  1. Select cbd.shp, zoning_cbd.shp and split_zoning_cbd.shp files and click Open.

../../_images/327.png
  1. You will see all three file paths in the text box beside Vector Dataset. Click Add followed by Close.

../../_images/413.png
  1. As we work on the exercise, it is important to save our work. Go to Project ‣ Save.

../../_images/512.png
  1. Save the project to the data directory as landuse_map.qgz file. The QGIS Project file contains references to the data layers and saves styles, map templates etc.

../../_images/612.png
  1. Select the zoning_cbd layer and click the Open Attribute Table button in the Attributes Toolbar. Note that the attribute INT_ZONE_C has the zoning codes and INT_ZONE_D has the zoning description. Close the attribute table.

../../_images/712.png
  1. Now let’s style the layer based on these attributes, so the parcels with the same zoning codes are styles in the same color. Click the Open the Layer Styling panel button in the Layers panel. Click the dropdown button next to Single Symbol.

../../_images/812.png
  1. Select Categorized as the renderer. Select INT_ZONE_C as the Value. Click Classify.

    ../../_images/912.png
  2. You will see a series of symbols appear. There is a different color symbol assigned for every unique code in the layer.

    ../../_images/1016.png
  3. Notice that each zoning category has sub-categories. The General Business (GB) category has further sub-divisions like GB1, GB2, and so on. For the purpose of this map, we can merge all the sub-categories to a single top-level category. Hold the Shift key and select all sub-categories. Right-click and select Merge Categories.

    ../../_images/1119.png
  4. Repeat the process for MU and TR categories. Once merged, we can now change the Legend label to be more descriptive. Click on the Legend label to rename a class.

    ../../_images/1217.png
  5. Enter descriptions of each zoning category based on the values given in the INR_ZONE_D column. As you enter those description, you will see the legend of the layer in the Layers panel also updates.

    ../../_images/1315.png
  6. Now we can update the colors and symbology of each category. Click on the Symbol for a category.

    ../../_images/1414.png
  7. Change the Fill color and Stroke color of the symbol to a color of your choice.

    ../../_images/1513.png
  8. Repeat the process for each category. The last category is all other values. This category contains all parcels which have NULL values. This is because those parcels have multiple zoning categories attached to them and are represented in the split_zoning_cbd.shp layer. We do not need them in this layer. Select it and click the - icon to remove that category.

    ../../_images/1612.png
  9. Next, select the cbd layer. Change the symbol to Simple Line and increase the Stroke width.

    ../../_images/1713.png
  10. The split_zoning_cbd.shp layer contains all parcels that were missing zoning codes in the zoning_cbd layer. The attribute table and values for the zones in the split_zoning_cbd are the same as the zoning_cbd layer. Instead of configuring the symbology for this layer manually, we can copy/paste the styles. Select the zoning_cbd layer, right-click and select Styles ‣ Copy Style ‣ Symbology.

    ../../_images/1811.png
  11. Now select the newly added split_zoning_cbd layer, right-click and select Styles ‣ Paste Style ‣ Symbology.

    ../../_images/1910.png
  12. You will see the same symbology being applied to the polygons in the split_zoning_cbd layer. The styling and legend are complete now.

    ../../_images/2010.png
  13. We have our layers styled and legend labels created. Now let’s create a map using these styled layers along with map elements like, scale bar, north arrow, labels etc. QGIS comes with a Print Layout that allows composing maps. Go to Project ‣ New Print Layout. When prompted for a name, you can leave it blank and click OK.

    ../../_images/2115.png
  14. In the Print Layout window, you will see a canvas. Right-click and select Page Properties.

    ../../_images/2212.png
  15. Set the Orientation to Portrait. Next, go to Add Item ‣ Add Map.

    ../../_images/2310.png
  16. Hold the left mouse button and draw a rectangle on the canvas. This is the map frame which will contain the map from the main QGIS window. In the Item Properties tab, use the Interactively Edit Map Extent icon to pan/zoom the content of the map frame.

    ../../_images/2410.png
  17. Scroll down in the Item Properties tab and check the Frame option. Expand it and select a Color for the frame border. You can also increase the Thickness.

    ../../_images/259.png
  18. The map frame is now ready. Let’s add other elements. Go to Add Item ‣ Add Legend.

    ../../_images/268.png
  19. Drag a rectangle where you want to place the legend. Once added, scroll down in the Item Properties tab and un-check the Auto update button so we can manually edit the legend items.

    ../../_images/279.png
  20. We have 2 layers with identical legends, so we can remove one of them. Select the split_zoning_cbd layer and click the Remove selected item(s) from legend icon. Similarly remove cbd layer from the legend.

    ../../_images/289.png
  21. Right-click the zoning_cbd layer and check the Hidden option.

    ../../_images/298.png
  22. Scroll down and expand the Columns section. Check the Split layers option and increase the Count to 2.

    ../../_images/307.png
  23. Scroll down further to the Spacing section. Adjust the spacing between different elements till the legend is clearly legible.

    ../../_images/3111.png
  24. You can change style and size of the fonts in legend from Fonts and Text Formatting properties. When done, go to Add Item ‣ Add North Arrow. Drag a rectangle where you want to place the element on the map.

    ../../_images/328.png
  25. Pick a symbol of your choice. Scroll down and expand the SVG Parameters. Change the Fill color and Stroke color as per your choice.

    ../../_images/333.png
  26. Now we will add a Scale Bar. Go to Add Item ‣ Add Scale Bar. Drag a rectangle where you want to place the element on the map. Adjust the Style and Segments parameters for the scale bar.

    ../../_images/343.png
  27. Our map needs a title and other information labels. Go to Add Item ‣ Add Label.

    ../../_images/353.png
  28. Enter a map title in the Main Properties section. Click the Font button under Appearance section to adjust the font size and style.

    ../../_images/362.png
  29. Add other labels indicating the data source and your name. Lastly we will finish our map by adding a frame around the label block. Go to Add Item ‣ Add Shape ‣ Add Rectangle.

    ../../_images/372.png
  30. Draw a rectangle. Click the symbol for Style and set the Fill Color to transparent and Stroke color to match other frames.

    ../../_images/372.png
  31. Once you are satisfied with your composition, you can export the result. Go to Layout ‣ Export as PDF. Save the PDF in your data folder as capetown_zoning_map.pdf.

    ../../_images/392.png

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