Difference between revisions of "Analyzing Crime Data in Ottawa using QGIS"

From CUOSGwiki
Jump to navigationJump to search
Line 85: Line 85:
   
 
[[File:pop2005.png|700px]]
 
[[File:pop2005.png|700px]]
  +
Figure is showing the population density by the wards for 2005 in Ottawa
+
"Figure is showing the population density by the wards for 2005 in Ottawa"
   
 
[[File:rob2005.png|700px]]
 
[[File:rob2005.png|700px]]
  +
Figure is showing the total number of robberies by the wards in 2005 in Ottawa
+
"Figure is showing the total number of robberies by the wards in 2005 in Ottawa"
   
 
Quick Comparison: Even though Somerset ward has the highest population density with Rideau Vanier ward. The total number of robberies are lower at Somerset ward compare to Rideau Vanier. Capital ward has one of the highest population densities in the city coming after Somerset ward and Rideau Vanier ward, however Capital ward has one of the lowest total number of robberies in Ottawa.
 
Quick Comparison: Even though Somerset ward has the highest population density with Rideau Vanier ward. The total number of robberies are lower at Somerset ward compare to Rideau Vanier. Capital ward has one of the highest population densities in the city coming after Somerset ward and Rideau Vanier ward, however Capital ward has one of the lowest total number of robberies in Ottawa.

Revision as of 14:35, 16 December 2015

Introduction

The main purpose of this tutorial was to determine the criminal trends based on the spatial locations in Ottawa using open source software. The QGIS was selected for the purpose of this tutorial it can be downloaded from: (https://www.qgis.org/en/site/forusers/download.html). The data includes many different crimes occurred in Ottawa from 2005 to 2013. The spatial locations include: Orleans, Innes, Barrhaven, Kanata North, West-Carleton March, Stittsville-Kanata West, Bay, College, Knoxdale-Merivale, Gloucester-Southgate, Beacon Hill-Cyrville, Rideau Vanier, Rideau-Rockcliffe, Somerset, Kicthissippi, River, Capital, Alta Vista, Cumberland, Osgoode, Rideau-Golbourn, Gloucester-South Nepean and Kanata South. Some of the crimes include: Total Criminal Code of Canada (CCC) including Traffic, Total Criminal Code of Canada (CCC) excluding Traffic, Crimes against Person, Total number of Homicides, Total Number of Attempted Murders, Total Number of Robberies and Total Number of Assaults (including Sexual Assaults), Total Number of Other Sexual Offences, Number of Abductions, Total Number of Uttering Threats or Intimidation Offences, Total Number of Other Crimes.

Where to get the data?

Based on the statistical data that the City of Ottawa Police Services provided, the Carleton University staff at the MADGIC desk created the shafiles and it was downloaded from the MacOdrum Library website. It is an open source data no login information is required. Retrieved from: http://madgic.library.carleton.ca/deposit/GIS/Crime_Statistics.zip

Wheretoget.png

Loading the Dataset into the QGIS

First step was to select Add Vector Layer symbol. Second step was to use Browse function to locate the data. Finally all shp files were selected from the Crime Wards Shp folder and loaded to the QGIS.

Loading.png

Layer Properties

Layers Properties can be opened by right clicking any of the layers and selecting properties. Right clicking the Layer Properties would bring up the following screen.Layer Properties include: General Settings, Style, Labels, Fields, Rendering, Display, Actions, Joints, Diagrams and Metadata.

Layerpro.png

General Settings

General1.png

Under General Settings:

  • Layer name can be modified and displayed as something else
  • Layer source can be modified
  • Data source encoding can be changed (System, Windows, and Macintosh etc.)
  • Coordinate Reference System can be changed
  • Scale dependency can be turned on to restrict the minimum and the maximum scale

Labels

Labels.png

Labels can be turned on turned and displayed for any columns. Labels Settings include:

  • Text (to modify the size, font style, transparency, color and style of the text)
  • Formatting (to modify the line height and alignment)
  • Buffer
  • Background (to modify the background settings)
  • Shadow
  • Placement (to modify the placement such as: offset from centroid, offset centroid, around centroid, using perimeter, horizontal and free and to set up priority for the text)
  • Rendering (to perform scale based visibility and pixel based visibility etc.)

Fields

Fields.png

Using the field properties fields can be edited, and new fields can be created using field calculator. New output-field name, output-field type, output-field width and output-field precision should be determined when creating a new column. As an example new field called “area” is created, which is under geometry function called “$area”. It is going to be used to determine the population density because the data does not have that information, it only has total population. (Area/ 1000000 was used to get the area km^2 value)

Creatingarea.png

Creating the population density field

The total population divided by the total area would give us the population density. This process needs to be done for each layer that is going to be used. I am going to repeat the same process for the 2010 and 2013 layers so that the comparison between those layers can be done. If you want to use other layers rather than 2005, 2010 and 2013, area calculation and population density needs to be done for the interested layers.

Popden.png

Rendering

Rendering can be done to simplify the geometry. Simplification threshold can be customized, and the scale can be set up for rendering process.

Render.png

Additional Settings under Layer Properties

Additionally Display Settings, Actions, Joints and Metadata can be accessed under Layer Properties.

Additionals.png


Using Style and Diagram Functions under Layer Properties

Style Function

Under Style there is a dropdown menu, which the Single Symbol, Categorized, Graduated, Rule Based, Point Displacement, Inverted Polygons and Heat Map can be selected. For the purpose of this tutorial I am mainly going to focus on the Graduated Style.

Single Symbol

Single Symbol Function is useful for showing the features without any categorization. As an example below: Map of Ottawa without any categorization.

Mapottsingle.png

Categorized Style

Categorized style is useful for showing simple categorizations. As an example below: Map of Ottawa showing the wards in different colors.

Catott.png

Graduate Symbols

Graduated Symbols are useful for displaying the features based on their numerical values. First style needs to be selected as Graduated then column needs to be selected and after that Classes, Color Ramp, and Legend Format needs to be determined. As an example: I have selected Population density for the column and set the class number to 10, then I have selected the color ramp to red (the higher the number the darker red it would be), and I have set the legend format to %1 - %2.

Graduate.png


Pop2005.png

"Figure is showing the population density by the wards for 2005 in Ottawa"

Rob2005.png

"Figure is showing the total number of robberies by the wards in 2005 in Ottawa"

Quick Comparison: Even though Somerset ward has the highest population density with Rideau Vanier ward. The total number of robberies are lower at Somerset ward compare to Rideau Vanier. Capital ward has one of the highest population densities in the city coming after Somerset ward and Rideau Vanier ward, however Capital ward has one of the lowest total number of robberies in Ottawa.