This project was originally written on 02/01/2021 as part of the Data Products course for the Data Science Specialization from Johns Hopkins University on Coursera
Objective
This report plots the speed cameras in the Greater Toronto Area from the data provided by Open Toronto, which can be found here.
Initialization
The following code is used to initialize the required libraries.
package 'opendatatoronto' successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\Mark\AppData\Local\Temp\RtmpglvqBO\downloaded_packages
The following code is provided by the Open Toronto site to download the dataset.
# get packagepackage <-show_package("a154790c-4a8a-4d09-ab6b-535ddb646770")# get all resources for this packageresources <-list_package_resources("a154790c-4a8a-4d09-ab6b-535ddb646770")# identify datastore resources; by default, Toronto Open Data sets datastore resource format to CSV for non-geospatial and GeoJSON for geospatial resourcesdatastore_resources <-filter(resources, tolower(format) %in%c('csv', 'geojson'))# load the first datastore resource as a sampledata <-filter(datastore_resources, row_number()==1) %>%get_resource()
Plotting the Data
The geometry in the dataset can be used directly with Leaflet, and the longitude and latitude do not need to be separated.
df <- data$geometry
Custom icons for the speed cameras can be used with the following code: