Approximate maps of the small towns of Aotearoa
Flying from Wellington to Auckland one evening, I saw the lights of the small towns of the North Island of New Zealand passing below like constellations and wondered if it was possible to create something similar using data.
Small towns of Aotearoa is the result. It shows an approximation of the nighttime lights of the 96 urbanised areas in New Zealand that are less than 25 square kilometres in size (25 square kilometres was just an arbitrary choice by me). It also shows a little outline map of the location of each town, as I found that I did not know many of them and got curious about exactly where they were.
I love the regularity of Martinborough and its town square:
And how Hokitika spills away from the Tasman Sea and up the river:
But my favourite thing of all is this little detail from the town of Te Aroha:
The R code that I wrote is here if you are interested.
Two main datasets were used:
Statistics New Zealand’s 2017 digital boundaries (the “generalised clipped” version).
Land Information New Zealand’s primary parcels.
Using the “urban areas” layer of the digital boundaries, I calculated the area of each and discarded those larger than 25 square kilometres.
The remaining areas were then buffered slightly (by 25 metres) and intersected with the primary parcels layer. The buffering was necessary to prevent odd things happening with parcels that are close to the boundary of each area, as the boundaries of areas are not exactly aligned to boundaries of parcels.
The intersection calculation was slow. There are over 2.5 million objects in the parcels layer, and some of the urban areas have very complex shapes around the coastline. I used parallel processing in R to speed things up a bit, although honestly the amount of time I spent fiddling with the parallel processing code to get it working probably nullified any gains I obtained.
I then plotted all parcels in each urban area that were between 200 and 2,000 square metres in size. I figured that very small or very large parcels were unlikely to correspond to a dwelling or some other building (remember my intent was to approximate the lights seen from an airplane flying over).
Some of the resulting maps were still a bit messy for my taste:
I decided to manually and arbitrarily erase parcels that didn’t look like they belonged to the urban area (like I said, this is just an approximation exercise, not a precise data visualisation). An iPad Pro and Apple Pencil were ideal tools for this task and made it a lot quicker than pointing and clicking with a mouse. I suppose I could have come up with some sort of algorithm but that would probably have taken as much time as doing it manually (having learned my lesson from the parallel processing part …). I also manually cropped the final maps to fit.