Java Python GGR273 Lab 1: Smart Cities – Bike Sharing Locations
Lab 1: Analyzing Bicycling Parking Locations in Toronto (15%)
Due: July 19th 2024 @ 11:59 pm EST through the Quizzes tab
Submit through Lab 1 and answer questions and submit file (.jpeg of your final map).
Objective: Analyze the spatial distribution of bike rack locations in Toronto using QGIS. Perform. proximity analysis, density analysis, buffers, and overlay analysis, and create a choropleth map with an inset map. Your final map will depict the density of bike-parking locations by Neighbourhoods.
Datasets:
Connect through CKAN in QGIS
1. Bike Parking Racks Toronto Data
Contains locations of bike rack locations in Toronto.
2. City of Toronto Open Data Portal
Provides points of interest on schools, parks, and libraries.
3. Geographic Boundary File of Neighbourhoods
Defines the geographic boundaries for Neighbourhoods in Toronto.
4. Statistics Canada Census Geographies: Provinces
For context for an inset map
Step 1: Installing QGIS
1. Download QGIS from the official website:
https://qgis.org/en/site/forusers/download.html.
2. Follow the installation instructions for your operating system (Windows, Mac, or Linux).
o For Windows, download the standalone installer and run it.
o For Mac, download the disk image (.dmg) and drag QGIS to your Applications folder.
o For Linux, follow the specific instructions for your distribution on the QGIS website.
3. Once installed, open QGIS and familiarize yourself with the interface by exploring the menus and toolbars.
Step 2: Setting Up QGIS
1. Open QGIS.
2. Create a new project by clicking Project > New.
3. Save the project by clicking Project > Save As... and name it "GGR273Lab1_Bike_Racks_Toronto_July2024.qgz".
4. Be sure to regularly save your work. Suggestion to back up to an external drive, USB key or cloud storage. You can use the UToronto 365 cloud storage.
Step 3: Importing Open Data
CKAN is the world’s leading open-source data portal platform. CKAN makes it easy to publish, share and work with data. It’s a data management system that provides a powerful platform. for cataloging, storing and accessing datasets with a rich front-end, full API, visualization tools and more. Ckan.org
1. Install the CKAN plugin – this connects the Toronto open data URL to QGIS
1. Go to Plugins > Manage and Install Plugins
2. Select CKAN Browser, install
2. Once the plugin is successfully installed it is ready for use. The plugin works
specifically for data that is stored in CKAN repositories. Prior to accessing data the plugin must be configured to link to a specific CKAN repository. This can be achieved by opening the CKAN Browser via Plugins — Open Data (CKAN)
Browser from and clicking on the Open Data (CKAN) Browser icon from within QGIS.
3. The first time the CKAN Browser plugin is opened a cache location needs to be identified. The cache stores temporary files that are required by the
plugin. Set the cache location to a temp folder.
Create a new folder on your computer for this
course. Label it GGR273 Summer 2024. Create a folder within that called Lab 1. And then another
folder called Temp (for temp workspace). Click
Save. This should make the CKAN Browser plugin available. This browser gives you access to API
instances – where datasets are listed to access.
• There are 200+ publicly available CKAN instances, however not all have the api-url identified, which is the method used to connect the CKAN
Browser plugin to an open dataset. Any CKAN api-url can be added into the CKAN API Endpoint, providing access to open data managed within CKAN.
4. To accessing a CKAN repository click Select CKAN Server button, a new window will open. This button is usually at the bottom left of the window box, under the
plugin version number.
5. From within the new window (CKAN Servers) enter the CKAN api-url to the City of Toronto open data portal:https://ckan0.cf.opendata.inter.prod-toronto.ca/api/3/)
1. You can use “test the connection” button to make sure it works. Make sure you are on the internet.
2. If it works – select the next button called
“Add CKAN server to list”
3. Name the server by typing into the box:
“City of Toronto Open Data Portal”
4. The City of Toronto
instance should load. Check the box next to it so it gets loaded
into your QGIS environment.
5. Once configured and connected to a CKAN repository all
available datasets are listed in the Search
Results section of the plugin. There are over
300 datasets in the City of Toronto repository. You can scroll through the list visually or use the search bar.
6. By selecting a dataset, clicking on and highlighting a dataset in the Search Result section, different information about the dataset becomes available, such as the description, file formats, and resource URL. Selecting a
dataset and checking the desired version/format the data is loaded into QGIS by clicking the Load Data button.
7. Load the Bicycle Parking Racks dataset as a SHP (Shapefile). You can try loading the other formats and see what they look like. Once you click the load button for the Bicycle Parking Racks shapefile (should be the first one on the list), the data should load into your QGIS project space.
The system will also open a text file of metadata. Metadata includes at data dictionary.
8. Locate and load the Neighbourhoods shapefile. Choose the file called SHP: Neighbourhoods – 4326.zip.
1. Currently Toronto has 158 neighbourhoods. The city used to use
140 neighbourhoods and some were split.
9. You can return to this plug in to load other files as needed through this lab. 10.Re-order the layers by clicking, holding your mouse click, and dragging to
reorder under the Layers section. This section of the QGIS environment is usually at the left-bottom window.
11.You should see the bike rack locations over top of the neighbourhood boundaries.
12.Open the attribute tables of both files to explore the non-spatial data.
Step 4: Choosing a Map Projection
Ensure spatial data is accurately represented on the earth for precise analysis and calculations. This map projection is specific to the geographic region and the known analysis functions in this lab. For this map, select NAD83 / UTM Zone 17N
(EPSG:26917). This map projection uses the NAD (north American datum created in 1983), and for UTM zone 17N. This will preserve area, which is important for our final map that focuses on density.
Set Project CRS:
1. Go to the Project menu.
2. Select Properties.
3. Click on the CRS (Coordinate Reference System) tab.
4. In the CRS tab, type "EPSG:26917" in the filter box.
o In the bottom box called Predefined Coordinate Reference Systems,
open the drop downs by clicking on the (very) small arrows. The nested
list will start withL Projected > Universal Transverse Mercator (UTM). If
you click through these, they will reveal the next layer/folder. The final one should have you able to select NAD83/UTM Zone 17N.
o Google the UTM grid and locate the zones for your own reference.
5. Select NAD83 / UTM zone 17N from the list.
6. Click OK.
Reproject Layers:
1. Right-click on the neighbourhood boundaries layer in the Layers panel.
2. Select Export > Save Features As....
3. In the CRS section, click on the CRS selector button.
4. In the Coordinate Reference System Selector, type "EPSG:26917" in the filter box.
5. Select NAD83 / UTM zone 17N.
6. Choose a location and filename to save the reprojected layer. Best to put it in the folder you made for this class. Remember - all shapefile sub-files need to stay
together as a team to work together!
7. Click OK to save.
8. Repeat these steps for the bike rack locations layer.
9. Go ahead and remove the layers that were originally loaded, that were of the
original map projection upon download. Now you should have two layers that are re-projected.
Verify CRS:
1. Right-click on each reprojected layer in the Layers panel.
2. Select Properties.
3. Click on the Information tab.
4. Ensure the CRS is set to "EPSG:26917".
Step 5: Buffer Analysis
Create zones around bike rack locations to analyze the coverage area and proximity to other features.
1. Select the bike rack locations layer in the Layers panel.
2. Open the Processing Toolbox by clicking Processing > Toolbox.
o Icon Description: The toolbox icon looks like a wrench and screwdriver crossed.
3. In the Processing Toolbox, search for Buffer and select Vector geometry > Buffer.
o Icon Description: The buffer tool icon looks like a concentric circle with a highlighted ring.
4. In the Buffer dialog, set the Input layer to the bike rack locations layer.
5. Set the Distance to 500 meters.
6. Choose a location to save the output file and name it "Bike_Sharing_Buffer.shp".
7. Click Run and then Close.
8. This is where the buffer tool is that you can use to answer the final questions for this lab.
Step 6: Proximity Analysis
Calculate the distance from bike rack locations to points of interest. Review the final questions for this lab and choose points of&nb GGR273 Lab 1: Smart Cities – Bike Sharing LocationsSPSS sp;interest that will help you answer the final questions.
1. Add a new layer representing points of interest (e.g., schools, parks) from the City of Toronto Open Data Portal plugin CKAN browser.
2. In the Processing Toolbox, search for Distance to nearest hub and select Analysis > Distance to nearest hub.
o Icon Description: The tool icon resembles a map marker with arrows pointing to it from different directions.
3. In the Distance to Nearest Hub dialog, set the Input layer to the points of interest layer and the Hub layer to the bike rack locations layer.
4. Choose a location to save the output file and name it "Proximity_Analysis.shp".
5. Click Run and then Close.
6. This is where the buffer tool is that you can use to answer the final questions for this lab.
Step 7: Density Analysis
Calculate the density of bike rack locations within each dissemination area of the city. This data will be used to generate your final map.
1. Ensure you have the geographic boundary file of Neighbourhoods to QGIS by following the same steps in Step 3.
2. In the Processing Toolbox, search for Count points in polygon and select Vector analysis > Count points in polygon.
o Icon Description: The tool icon looks like a polygon with points inside.
3. In the Count Points in Polygon dialog, set the Input layer to the
Neighbourhoods layer and the Points layer to the bike rack locations layer.
4. Choose a location to save the output file and name it "GGR273_Lab1_Density_Analysis.shp".
5. Click Run and then Close.
6. This is the data you will use to make your final map.
More info about the Count Points in Polygon tool: Weight Field:
• This is optional and is used if you want to weight the points by some attribute. If your point layer (bike racks) has an attribute that you want to use as a weight
(e.g., the capacity of each bike rack), you can select that attribute field here.
• If you don't have a weighting attribute or don't need to weight the points, leave this field as "None."
Class Field:
• This is also optional. If you have a categorical attribute in your point data (e.g., type of bike rack), you can use this field to classify the counts by different
categories.
• If you don't need to classify the points, leave this field as "None." Count Field Name:
• Enter a name for the new field that will be added to the polygon layer. This field will contain the count of points within each polygon.
• For example, you could name this field "Bike_Rack_Count."
Step 8: Symbolization and Categorization
Visually differentiate and categorize the density data on a map. Also change the
symbology for the bike-parking locations, and any other geospatial data you want to use in your final map.
1. Update the symbology for the bike rack point data
2. Update the symbology for your bike rack density by neighbourhood polygon dat
1. Open the Layer Properties:
1. Right-click on your neighbourhood boundaries layer in the Layers panel.
2. Select Properties.
2. Go to Symbology: In the Layer Properties window, select the Symbology tab on the left.
3. Select Categorization Scheme: Change the Render type dropdown to Graduated. Select the newly created field for density of bike racks (e.g., "Bike_Rack_Count") in the Value dropdown.
4. Choose Classification Method:
1. Click on the Classify button to see the different categories.
2. Try different Mode options (e.g., Equal Interval, Quantile, Natural Breaks) and observe the distribution in the preview.
Hint: Use the Histogram to help determine which classification method best represents your data distribution. Look for methods that provide meaningful distinctions between neighbourhoods.
5. Choose a Color Ramp:
1. Click on the Color ramp dropdown and select a color gradient that represents the density well (e.g., from light to dark to show low to high density).
2. Adjust the color ramp if necessary by clicking on Color ramp and choosing Invert color ramp if it suits your needs.
6. Click Apply and then Ok to close the layer properties window.
Step 9: Creating the Choropleth Map
Visualize the density of bike rack locations by Neighbourhoods across the city. You do not need to include the point locations of bike rack locations on this map.
1. Download Ontario Boundary Shapefile:
o Use the Statistics Canada Open Data Portal for census boundaries to
download the cartographic boundary file (.shp) for provinces:
https://www12.statcan.gc.ca/census-recensement/2021/geo/sip- pis/boundary-limites/index2021-eng.cfm?year=21
o Load this file into QGIS
o Re-project it so its in the same map projection as all other layers
2. Create the Inset Map:
o In the Layers panel, duplicate the neighbourhood boundaries layer (right- click and select Duplicate Layer).
o Rename the duplicated layer to "Toronto Highlight."
o Symbolize the "Toronto Highlight" layer with a distinctive color and transparency to make it stand out.
o Right-click on the Ontario boundary layer and select Properties.
o In the Symbology tab, choose an appropriate style to differentiate Ontario from the inset map.
3. Configure Inset Map Layout:
o Open the Print Layout via Project > New Print Layout.
o Add the main map by clicking Add Map and drawing a rectangle in the layout.
o Adjust the position and size for a good balance (consider the 6 principles of cartographic design).
o Add the inset map by clicking Add Map again and drawing a smaller rectangle.
o In the Item Properties panel, set the inset map to display the Ontario boundary with Toronto highlighted.
o Add a neatline around the inset map for clear separation.
4. Add Basemap:
o Install QuickMapServices Plugin:
1. Go to the Plugins menu and select Manage and Install Plugins.
2. Search for QuickMapServices and click Install Plugin.
3. Access QuickMapServices:
1. After installation, go to the Web menu.
2. Select QuickMapServices > OSM > OpenStreetMap.
3. This should add the basemap. This is sufficient for a map for this lab to add context. You shouldn’t have to add any extra labels to the context.
3. Final Touches
1. Label the City of Toronto:
o In the main map, use the Label tool to label the city of Toronto clearly.
2. Ensure Map Elements:
o Verify that all map elements (title, legend, scale bar, north arrow, neatline) are properly placed and visible.
3. Review:
o Ensure your map follows the 6 principles of cartographic design: color,
symbology, map elements, balance, hierarchical organization, and visual contrast. This is what your map will be graded on.
Step 13: Exporting the Map
1. Once you are satisfied with the map layout, go to Layout > Export as Image.
o Icon Description: The export icon looks like a disk with an arrow.
2. Set the resolution to 200 dpi, page size to A4 (landscape), and save the image as "GGR273_Lab1_BikeRack_Map_Toronto.jpeg".
3. Open the file and ensure it saved properly and is a map that takes up a full page in a landscape view.
4. Ensure the text is readable, the information isn’t blurry, and that you have met all the instruction requirements.
Step 14: Answering Questions Answer the following questions based on your analysis in the Quizzes tab for Lab 1 by July 19th at 11:59pm EST:
1. 2% - True or False: The majority of bike rack locations in Toronto are within 500 meters of a park. (True/False)
2. 5% - Multiple Choice: What is the most common type of point of interest (POI) within 500 meters of bike rack locations?
o A) Schools
o B) Parks
o C) Libraries
3. 2% - Fill in the Blank: The average distance from bike rack locations to the
nearest school in Toronto is approximately meters.
4. 6% - Submit your map image as a .jpeg file for the final and 4th question
5. Submit your QGIS project as a zipped file using the following instructions (not graded but required to receive full marks. We are using this to ensure you are completing your own work):
1. Save all your QGIS project files and layers.
2. Compile the following into a single ZIP file:
o QGIS project file (GGR273_Lab1_BikeRack_Toronto.qgz)
o All shapefiles created during the lab (e.g.,
GGR273_Lab1_BikeRack_Buffer.shp, Proximity_Analysis.shp, Density_Analysis.shp, Selected_POIs.shp)
o The exported map image
(GGR273_Lab1_BikeRack_Map_Toronto.jpeg)
o A text file with answers to the questions that has your name and student number on it.
3. Note that the ZIP file submission is for checking your work process and is not graded. The graded submission are questions #1-4 in the quiz and includes:
o Answers to the questions
o The final map as a .jpeg
4. Submit the ZIP file and the final map image to the course's assignment submission portal