Difference between revisions of "Creating Thematic Maps Using the Cartographic Composer in GRASS GIS"

From CUOSGwiki
Jump to navigationJump to search
Line 102: Line 102:
 
Border: This setting allows the user to draw a border around the map frame. The colour of the border and the width of the border can be changed. There is also a check box where the user can uncheck if they prefer to not have a border around their map frame.
 
Border: This setting allows the user to draw a border around the map frame. The colour of the border and the width of the border can be changed. There is also a check box where the user can uncheck if they prefer to not have a border around their map frame.
   
[[File:Figure 21.jpg|center|thumb]]
+
[[File:Figure 21.jpg|left|thumb]]
 
Map frame settings in GRASS.
 
Map frame settings in GRASS.

Revision as of 19:35, 10 December 2020

Introduction

The purpose of this tutorial is to introduce basic operations in GRASS GIS and use the Cartographic Composer to create a thematic map demonstrating red light camera violations in the City of Ottawa in 2016. The same map will then be created in QGIS to determine and compare differences in creating the visual aspects of the final map products. This tutorial is ideal for a beginner using the GRASS GIS Cartographic Composer, and also touches a bit on the functions of the GRASS GIS program in general. The data used for this tutorial is open data, which is available from the City of Ottawa and Scholars GeoPortal. GRASS GIS version 7.8.4 and 3.14 "Pi" version of QGIS is used during the tutorial.

Link to Open Ottawa data: https://open.ottawa.ca/

Link to Scholars GeoPortal: http://geo2.scholarsportal.info/

GRASS GIS and QGIS are both available for Windows, Linux and MacOS X. This tutorial will be performed using a Windows machine.

Link to QGIS website, where you can download the program for all three operating systems: https://qgis.org/en/site/forusers/download.html

Link to GRASS GIS website, where you can download the program for all three operating systems: https://grass.osgeo.org/download/

Obtaining the Data

The data that will be used during this tutorial is a base layer of the City of Ottawa from Scholars GeoPortal and two datasets from Open Ottawa: Red Light Camera Violations 2016 and Red Light Camera Violations 2019. Any open data from the City of Ottawa can be used during this tutorial but this is the specific data that will be used for the purpose of the tutorial.

Figure 1ScholarsPortal1.jpg

Base layer data of the City of Ottawa selected for the purpose of the tutorial.

Figure 3Redlight.jpg

Open data of 2016 red light camera violations downloaded for the purpose of the tutorial.

Once all of the data of your choice has been downloaded, it is ready to be imported into GRASS GIS.

Importing the Vector Data into GRASS GIS

The first step is importing the data into GRASS GIS. Start the program and select the GRASS location desired, and create a new GRASS Mapset. I have created a new mapset in GRASS called 2016 Red Light, which will be the mapset for the 2016 red light violations. The GRASS "Location" button is the location of the data on your computer. The "Mapset" button is where map data is located.

Figure 4NewDemo.jpg

Creating a new mapset in GRASS. When creating a name for the mapset, only ASCII characters can be used. When finished, select Start GRASS session.

Figure 5.jpg

Main screen of GRASS in Windows.

Two files came with the Ottawa boundary shapefile that was downloaded for the City of Ottawa. The first one contains Census Divisions, and the other contains Federal Electoral Districts. Federal Electoral Districts are subdivisions in the City of Ottawa. Including these in the map will allow the user to determine in which subdivision the most red light violations occurred.

Next, import all three of the vector layers into GRASS GIS, under File>Import vector data>Simplified vector import with reprojection [v.import].

Figure 6Importing.jpg
Figure 8ImportingVectors2.jpg

Importing Census Divisions shapefile into GRASS. Make sure to check "Override projection check (use current location's projection)". Click import once the correct file has been selected. Repeat this for the other two files, the Federal Electoral Districts shapefile and the 2016 red light data (or whatever data you have chosen to present on the map).

After importing all of the shapefiles, the map display in GRASS should display the City of Ottawa and all of the red light camera violations in 2016. The map demonstrates that the majority of red light camera violations are in Nepean, Downtown Ottawa and East Ottawa.

Figure 10.jpg

This is how the map should look in the Map Display in GRASS. Don't worry about the layout, the next section explains how to change the symbology of the red light camera violations and the colour/display of the map.

Editing the Map Layout in GRASS GIS

As seen in the Map Display, the map colour and the symbology of the map needs to be altered. The next step is to add labels to the subdivisions in the City of Ottawa. To check the attribute data of vector datasets in GRASS, highlight a vector file and click the Attribute Table Manager button on the task manager bar in GRASS.

Figure 11.jpg

Attribute manager button in GRASS (highlighted in blue).

Upon clicking the attribute manager button, a new window will open.

Figure 12GRASS.jpg

The attribute manager shows the data of the vector file. Looking at the attribute data, I am going to use the attribute "FEDNAME" to label the City of Ottawa because it clearly demonstrates the subdivisions within the city. To do so, right click the Federal Electoral Districts layer and click Properties. Navigate to Labels (d.vect) where you can label the map by the attribute "FEDNAME". In the Labels tab, you can also adjust the label colour, label background colour, label border colour, font size, label placement and the font name. For simplicity, I selected the Tahoma Regular font in a size 7 with a white background.

Figure 13.jpg

Map with the label tab in the Properties window of the Federal Electoral Districts layer (d.vect)

The next step is to edit the appearance of the symbology. To edit the symbology, right click the 2016 red light camera violation layer and navigate to Settings in the drop down toolbar (d.vect). For the purpose of the tutorial, I am going to create red circles for the red light cameras in Ottawa and label the total violations next to each point. First, change the symbol from an X to a circle and change the colour to red.

Figure 14.jpg

(d.vect) window, where the Symbology of the map can be edited. This photo demonstrates how to change the symbol on the map.

Figure 15.jpg

(d.vect) window, where the colour of the symbol can be changed.

Figure 18.jpg

(d.vect) window, where I am adding a label on the 2016 red light camera violation vector layer, using the column TOTAL_VIOL (Total Violations) to label the amount of red light camera violations on each point

Fiigure 16.jpg

The map so far after adding labels and changing symbology of the red light camera layer, using (d.vect). The map clearly states the locations of red light cameras in Ottawa, and the total violations for each one in 2016.

During the creation of the map in GRASS GIS, make sure to save often to make sure the work so far will not be lost. The save button is in the toolbar and can also be accessed using Ctrl+S.

Figure 19.jpg

Using the Cartographic Composer in GRASS GIS

Now that the tools in the Map Composer have been explored a bit, it is time to start using the Cartographic Composer in GRASS to produce a final map product. The first step is navigating to File>Cartographic Composer [g.gui.psmap]. The default page size will be A4 so adjust the page size by going to File>Page Setup (Ctrl+P).

Figure 20.jpg

Next, in order to import the vector layers into the Cartographic Composer, a map frame needs to be selected. The map frame tool is located on the Cartographic Composer. Once the tool is selected, drag it on the page. The vector layers I have selected for the purpose of the tutorial are in a square shape, so I have created a map layer in the shape of a square. Once a map frame has been selected, a window called Map frame settings will pop up.

An overview of the map frame settings:

Map frame options: select fit frame to match selected map. This setting fits the map frame created to the raster or vector layer chosen in the map dropdown.

Map selection: either raster or vector can be selected. For the purpose of the tutorial, I selected vector because I am working with vector data. If you are working with raster data and looking to get the map frame to match the raster map, select raster. DEM maps would be added into the map frame as a raster. The drop down allows the user to select which layer they want to be displayed in the map frame. I chose DLI_2016_Census_CBF_Eng_Nat_fed, the vector layer with the Federal Census Districts of the City of Ottawa.

Map scale and center: This setting is available if "fixed scale and map center" is selected in the map frame options drop down. It allows the user to manually set their own scale and center.

Map max resolution: Measured by dots per inch. 300 is standard.

Border: This setting allows the user to draw a border around the map frame. The colour of the border and the width of the border can be changed. There is also a check box where the user can uncheck if they prefer to not have a border around their map frame.

Figure 21.jpg

Map frame settings in GRASS.