Back in 2015 Open Innovations' Tom Forth created the Parkulator tool. The Parkulator calculates the amount of land used for parking within a user-selected map area, and tells you how many homes or parks could be built in the space instead. Initially it worked for specific areas of the UK but Tom improved it to work for the whole world. In 2020 Tom and Dan created the Golfulator which did a similar thing for golf courses.Both the Parkulator and Golfulator work really well but there were a couple of behind-the-scenes limitations. With a bit of spare capacity between other projects, I thought I'd attempt to create a new version of the Parkulator which tackled those limitations and added some new features whilst I was at it.
Both of Tom's tools were built on extracts of Open Street Map data. Open Street Map is fantastic because it gives us consistent mapping across the whole planet under an open licence that means we can re-use the data in projects like this. However, extracting all the parking areas (or golf courses or any other feature type) from Open Street Map takes quite a bit of time and computing resources. For example, the current "planet file" is 66GB compressed. As a result, Tom had only updated the data behind his tools a few times.
Initially I thought about having a process running on a Raspberry Pi to make daily extracts like my 2020 experiment for extracting the world's bins/trees. However, each new feature type (e.g. golf courses or brownfield land) that we might want to add will require lots of work. So I looked for other options. I turned to the Overpass API which lets you extract custom data from Open Street Map as JSON. This required a bit of effort to understand the way the data were structured - e.g. "MultiPolygons" had to be constructed from "nodes", "ways", and "relations" - but ultimately means I could show results for a particular bounding box on a web map.
Overpass stays up-to-date so if people fix/update the data in Open Street Map, it'll be available via Overpass not long after (within hours). The other advantage of using Overpass is that it is then really easy to add a new comparison by deciding which features to include. So, I was able to add brownfield land by asking for landuse=brownfield. All these requests are only as good as the completeness of the underlying data but the Parkulator lets people see what might be missing from the map and they can go add it to Open Street Map.
Parkulating known areas
A key part of Tom's tool was being able to draw a user-defined area to "parkulate". But what if you want to, say, get all the parking within Leeds? You could draw what you think the outline of Leeds is but wouldn't it be better if the Parkulator loaded the outline of Leeds for you? Another project we've worked on at Open Innovations could help with that. Our "geography bits" repository contains individual geojsonl extracts for various UK geographies so that we can easily grab the polygon if we know the ID of the area e.g. the 2021 local authority boundary for Leeds (E08000035). So I hooked up a simple search box that has a list of all UK MSOAs, wards, constituencies, and local authorities and then requests the file for the appropriate "bit" of geography.
Having made it easy for UK-focussed people to load in known areas, my attention next turned to the rest of the world. What are "known areas" in the context of the whole world? Are there standards? It turns out there is an ISO standard - ISO 3166-2 - which defines codes for "principal subdivisions" of countries. In the UK these can be local authorities (e.g. Bradford, Leeds, Calderdale) but also the nations (e.g. England). In the US though, these are the 50 States. That doesn't exactly help people who want to parkulate their town or area of a city. Back to the drawing board.
Again, Open Street Map might have the answer. Around most of the world people have contributed the shapes of their local administrative boundaries. These cover almost every type of administrative type you can imagine - bundesland, províncias, counties, cities, towns, cantons, neighbourhoods etc. Each is tagged with
admin_level= although what is at each level differs from country to country. I ended up with 596,907 areas each of which has an OSM relation ID. Unfortunately, I realised that none of them really noted the region/country they were in so using this in a list of search results would end up with, say, multiple versions of "Lisbon" and no real way to tell them apart. To fix this problem I turned to Geonames.org who provide really useful, CreativeCommons-licensed, gazetteer of places. This means we can get the region and country for everywhere with a population over 1000 people. I managed to find 82,644 places that I could match between the Open Street Map area extracts and Geonames.org.
Having a list of OSM IDs, I first tried to use French Open Street Map's useful polygon extractor tool e.g. 118327 gets the boundary of Leeds as GeoJSON. However I quickly ran into the problem that it doesn't allow requests from external websites which stops me using it for the Parkulator. That meant I'd have to build my own source of polygons. Following what we've done for UK geographies, I created a specific repository for the 82,644 OSM IDs I'd identified and you can read more about the process there. The end result: I've been able to add a global area search to the Parkulator.
A sunny outlook
Recently in the UK, there have been conversations about the number of solar generation farms in different places. Now that it is easy to add layers, I added generator:source=solar so that we could be a bit more informed. Obviously the data may not be complete but I was aware that in 2019 there had been a UK OSM quarterly project to improve it so I hope it isn't too far off reality. I also added a calculation to the popups that provides a potential power generation in MW if you converted the selected features into solar farms.