Mapping Toronto's 'Geography of Difference' for The Local

Mapping Toronto's 'Geography of Difference' for The Local

local light 2D-IMAGE EXPORT-1558066492640.png

Over the winter we’ve had our heads down working on a project with our friends at The Local, in preparation for the re-launch of their publication and brand new website.  The first issue in their new, quarterly format is titled “The Geography of Difference” and our role was to provide interactive mapping describing how socioeconomic differences across the city align with health outcomes.  To do this we chose to interpolate spatial data at various scales and generate contour lines, giving us a topographical aesthetic and effective means of showing spatial patterns across the whole city. The process involved several tools including QGIS and GDAL, TippeCanoe and Mapbox Studio and Mapbox GL JS.

We explored a variety of data sets for inclusion in the project and ultimately landed on the following:

For personal income we showed values as a percentage of the CMA average income. For premature mortality and diabetes rates we showed the values as a ratio to the Toronto aggregate rate.

Using QGIS and GDAL we ran an inverse distance weighting (IDW) interpolation algorithm to model values in each data set.  This approach takes the centroid of each polygon feature and estimates the values in between centroids, with the impact of surrounding centroids decreasing with distance.  The result was 5 interpolated layers, which we then converted to contours using GDAL. To clarify, here is an example showing stages of the process for census tract level data. 

31hfzp.gif

It’s important to note that the interpolation process generates a layer that is only as detailed as the input data. Given that the spatial data we used for this project was aggregated to various scales, the interpolated surfaces also have varying levels of detail. The income layer was available at the highest level of detail (dissemination areas) followed by the Family Health Team Patients (census tracts) and the walkscore, diabetes rate and premature death rate data were available at the lowest level of detail (neighbourhoods).

Given that the layers we generated were quite complex, it was necessary to convert the geojson files into MBtiles (a Mapbox file format optimized for use with their platform) using Tippecanoe before we could upload the data to Mapbox studio, and begin styling.   We used the following command to convert the layers (scroll right to see full text):

tippecanoe -o [mbtile] --coalesce-densest-as-needed --full-detail=12 --low-detail=11  -z15 -Z7 [geojson]

With MBtiles uploaded, we generated both 2D and 3D representations and styled them to show the variation across each dataset, both quantitatively and spatially. We manually set the colour values to highlight extreme values and broad trends. Building on our ‘Every Building in the GTHA’ project, we developed a guided tour of the data, using Mapbox GL, to walk readers through the narrative developed by Tai Huynh and Nick Hune-Brown at The Local.

thelocal.gif

Click the image to visit the final product and don’t hesitate to reach out to us if you have any questions about this process.

Ontario Elevation Map

Ontario Elevation Map