Processing shapefiles from the ONS geoportal

Our map templates can work with different types of geography (local authority, regions, CCG, LSOA, MSOA etc). The problem is that these geographies are often updated. Luckily we have a canonical source of geographies in the ONS Geoportal.

To get the various geographies to work with our templates, we have to rename the columns and get rid of any extra information that we don’t need. We could do this in QGIS and it would take about 5 minutes.

But why wait 5 minutes when it could be done in 5 seconds! Hello bash script.

You’ll need download the script, make it executable with chmod u+x and copy it to /usr/local/bin.

Next point the script at a zip file of a shapefile download from the geoportal.

It will unzip and inside with be a .topojson file called geog.json which you can use in the templates.