Ontario Demographics Data Visualization

Introduction

The purpose of this project is to visualize any kind of data on a webmap. Using open source software, such as QGIS, solves one aspect of this problem. The other part of this problem is to answer this question:

How and what data can be visualized? Data can be stored in a variety of formats, and organized differently. The most important aspect of spatial data is the spatial information itself and so we need to figure out a way to display the data using textual descriptions, symbols, colours, etc. at the right location.

Methodology

In this visualization, I am using the census subdivisions (downloaded from Statstics Canada website) as the basic geographical unit, plus the 2016 census profile for the census subdivisions (also downloaded from Statistics Canada website). Once these data were downloaded, the next steps were to inspect the data and organize them in a fashion so that they could be easily visualized by the shapefiles. In order to facilitate this task, we can use any relational database management system, however, my preference was to use SQL Server 2017 express edition. Once the 2016 census profile has been imported into SQL Server, the “SQL Queries” [1] file can be run to organize the data into a relational table that can be exported, or copied directly from the result-set on management studio and pasted, into excel/csv; the sheet/file can now be opened in QGIS and joined to the shapefile of Ontario Census Subdivisions [2] using CSDUID as the common field between the two files.

Using the qgis2web plugin, all data and instructions are manually chosen on a number of tabs. You can choose the layers and groups you want to upload, and then customize the appearance and interactivity of the webmap based on available options. There is the option to use either Leaflet, or OpenLayers styles on QGIS version 3.8. You can Update preview and see what the outcome will look like. You can then Export the map and the plugin will convert all the data and instructions into json format. The most important file – index.html – is created on the directory you have specified.

index.html [1] is the file that can be used to visualize the map on the web browser, however, you need to first download all the files and folders from the source page [1]. This will put all the files on your (client) machine which makes it possible to open index.html on localhost. If the map files are uploaded on a web server, then the map can be viewed by the world wide web.

Webmap

The data being visualized belongs to the population demographics (different age groups). The map of Ontario’s census subdivisions is visualized as a transparent choropleth map of 2016 population density. Other pieces of demographics information are embedded within the pop-up for each of the census subdivisions. If you hover your cursor on each of the census subsivisions, it will be highlighted with a transparent yellow colour so you can see the basemap information on the basemap clearer. If you click on them, the pop-up will appear on the screen, and you can scroll through it.

There are other interactive utilities on the map such as controllers for zooming in and out, a (ruler) widget to make measurements, a (magnifying glass) widget to search the entire globe, a (binocular) widget to search only the layers uploaded on the map, and a (layers) widget to turn layers and basemaps on and off.

Limitations

There are some limitations that I encountered after I created this webmap. The first, and most important limitation, is the projection of the data on the map. The original shapefile was using the EPSG code of 3347 which uses the Canada Lambert Conic projection with NAD 1983 datum. The plugin converted data into the most common web projection format, WGS 1984, which is defined globally by Longitude and Latitude. Although WGS 1984 prevents the hassle of using projected coordinate systems by using one unified geographic projection for the entire globe, nevertheless, it distorts the shapes as we move farther away from the equator.

The second limitation was the fact that my transparent colours were not coded into the index.html file. The opacities are defined as 1. In order to control the level of opacities, the index.html file must be opened in a text editor, the opacities changed to the proper levels, ranging between 0 and 1, and lastly save the edits on the same index.html file.

The next limitation is the size of files that can be uploaded on github [3]. There is a limit of 100 MB on the files that can be uploaded to github repositories, and because the size of the shapefile for entire Canadian census subdivisions is over 100 MB, when converted to json, it could not be uploaded to the repository [1] with all the other files. However, it is possible to add to geojson formatted file (of census subdivisions) to the data directory of the repository on the localhost machine, and manually add its location with a pair of opening and closing script tags on the index.html file on the body tag. In my case, the script was:

<script src=”data/CensusSubdivisions_4.js“></script>

The name of the file should be introduced as the very beginning line of the geojson file as a variable:

var json_CensusSubdivisions_4 = {

And don’t forget that the last line should be a closing curly braces:

}

Now index.html is aware where to find the data for all of the Canadian census subdivisions.

What’s Next?

To conclude with the main goal of this project, which was stated in the introduction, we now have a framework to visualize any data we want. Which data we want to visualize should change our methodology becasuase the scripts can be adapted accordingly. What is more important is the way we want the data to be visualized on the webmap. This tutorial presented the basics of qgis2web plugin. Once the index.html file is generated, other javascript libraries can be added to this file, and depending on your level of comfort with javascript you can expand and go beyond the simple widgets and utilities on this webmap.

  [1]  https://github.com/Mahdy1989/GeoVisualization-Leaflet-Webmap/tree/master  

 [2] There is a simple way to limit the extent of the census subdivisions for the entire Canada, to the Ontario subset only: filter the shapefile by PRUID = '35' which is the code for Ontario.

[3]  https://help.github.com/en/github/managing-large-files/what-is-my-disk-quota 

Story Swipe Map – 2011 / 2015 Election Results

Geovis Course Assignment, SA8905, Fall 2015 (Rinner)
Author: Austin Pagotto
Link to Web app: http://arcg.is/1Yf8Yqn
(Note: project may have trouble loading using Chrome – try Internet Explorer)

Project Idea:

The idea of my project was to comprehensively map the past two Canadian federal election results. When looking for visualization methods to compare this data I came across the Swipe feature on the ArcGIS Online story maps. Along with all the interaction features of any ArcGIS online web map, this feature lets the user swipe left and right to reveal either different layers or in my case different maps. As you can see in the screenshot below the right side of the map is showing the provincial winners of the 2015 election while the left side of the map is showing the provincial winners of the 2011 election. The middle line in the middle can be swiped back and forth to show how the provincial winners differed in each election.

Pic1

Project Execution:

The biggest problem in executing my project was that the default ArcGIS online projection is web Mercator, which greatly distorts Canada. I was able to find documentation from Natural Resources Canada explaining how Lambert Conformal Conic basemaps can be uploaded to an ArcGIS online map and replace the default basemaps.

Another problem with my visualization of the project was that when zoomed to a national scale level, a lot of the individual polling divisions became impossible to see. This creates an issue because each polling division is designed to have a somewhat equal population count in them. So the small ones aren’t less important or less meaningful than the big ones. To solve this, when zoomed out, I changed the symbology to show the party that had won the most seats in each province, so it would show the provincial winner as seen in the previous screenshot. When zoomed in however the individual polling divisions become visible, showing the official name at increased zoom levels. The years of each election were added to the labels to help remind the user what map was on what side.
pic2

The methodology I used to create this project was to create two different online maps, one for each election year. Then I created the swipe web app which would allow both of these maps to be loaded and swipeable between the two. It was important here to make sure that all the settings for each map were the exact same (colors, transparency and attribute names).

The data that is shown on my maps were all downloaded from ArcGIS online to Arcmap Desktop and then zipped and reuploaded back to my project.  It was important to change my data’s projection to Lambert Conformal Conic before uploading it so that it wouldn’t have to be reprojected again using ArcGIS online.

This project demonstrated how web mapping applications can make visualizing and comparing data much easier than creating two standalone maps.

Data Sources: Projection/Basemap information from Natural Resources Canada
Election Data from ESRI Canada (downloaded from ArcGIS Online)

Link to Web app: http://arcg.is/1Yf8Yqn