The other day the New Your Times did a really fun story on buildings in the US, and I was chatting about that with someone at the VPL last night. Which reminded me that I wanted to replicate that for Vancouver. So here we go.
There are several datasets for building data, and we have worked quite a bit with the City of Vancouver LIDAR generated data of 2009. We have mapped this on several occasions in the past, for example to show building heights, or just residential buildings to map building values, and have used the building heights data in Vancouver and Toronto to make building heights profiles by distance from downtown.
Another great source, in many ways better for this project, is OSM building data. It’s not very good at 3D data, but the footprints are pretty up-to-date.
I really liked the simplicity of the NYT map, so why not make yet another building map? These kind of “naked maps” can be quite revealing, and it reminds of the naked bike maps from the WaPo WonkBlog that we also imitated, although it seems that my live maps did not survive my blog update. The WaPo even made a quiz to have people guess cities by the naked bike maps.
Vancouver building footprints
This is a good opportunity to use the excellent mapdeck package that provides R bindings to deck.gl. The maps are interactive, you can zoom and pan, but they only cover the City of Vancouver. It may take a moment for the data to load.
If you want to enjoy this in detail, head over to the fullscreen version.
If you want some context, here is another one with streets and street names.
We do have another source of buildings: Open Street Map. And that data comes tiled on most basemaps. With modern vector maps it’s easy to make a map with just the buildigns, but the disadvantage is that the buildings are only visible when zoomed in quite closely, vector tiles at higher zoom level typically don’t come with the buildings data.
The problem here is that the buildings disappear when zooming out, that’s because the data is served as vector tiles, and buildings are omitted for higher zoom levels.
One way around that is to download the buildings from osm first. We quite like Geoff Boeing’s OSMnx package, so that gives us a chance to try out the better python integration in R notebooks in RStudio 1.2. Things are still not as smooth as one would like, and I could not figure out how to pass binary geographic data from python to R, but transforming to geojson gets the job done.
Again, you can also view this map fullscreen. The advantage of grabbing the data form OSM is that this immediately generalizes to everywhere where we have OSM building data.
As always, the code for this post is on GitHub. If you want maps for other cities in Canada or elsewhere in the world, just grab the code and modify it to your liking.