olihawkins

A hexmap of district and unitary local authorities in England and Wales

4 Feb 2018 20:57 GMT

Last week I posted an interactive hexmap showing internal migration in England and Wales. Today I am publishing the boundaries for the hexmap so that other people can use them to show data for the same geographical areas.

The hexmap represents the 348 lower-tier (district and unitary) local authorities in England and Wales. The map preserves the organisation of local authorities within their countries and regions.

A hexmap of lower-tier local authorities in England and Wales where each hex is shaded according to its region.

The boundary data for this hexmap can be found in the files linked below in HexJSON and GeoJSON formats.

Arranging the local authorities where you would expect to find them, while preserving their geospatial relationships to one another and their regional groupings was not easy. Each solution to a particular difficulty created its own new problems, and it was often a question of deciding which arrangement was least unsatisfactory.

What this process has taught me is that hexmaps that represent real geographies are a useful fiction, and producing one involves making compromises. So while I am happy with the arrangement shown here, it is by no means definitive. Feel free to take it as a starting point and modify it further. I would be interested to hear of any changes or improvements.

The map was made using an interactive tool I have written for editing HexJSON data in the browser. I intend to put it online once I have had an opportunity to tidy up the code a bit.

Finally, I want to say thanks to Carl Baker, who kindly reviewed the work and suggested some improvements. Carl not only has great mapping skills, but also a remarkable memory for the geography of the UK, so he was able to spot problems and suggest solutions quickly.

A simple hexmap editor

7 Feb 2018 21:15 GMT

I recently produced a hexmap of local authorities in England and Wales, which I need for mapping a number of different datasets, such as data on internal migration. As I couldn't find an existing hexmap for these areas, I had to create one from scratch.

Initially, I hoped to generate a hexmap algorithmically using the geogrid package in R. But while geogrid did a decent job of minimising the average distance between where areas were located on the geographic map and on the hexagonal map, the number of local authorities and the variation in their size led to some odd results. Birmingham was on the coast, for example.

Furthermore, the algorithm that geogrid uses isn't designed to preserve certain geospatial relationships, such as contiguous groups of areas like regions, or relative positions that matter logically. For instance, in the original output from geogrid, South Tyneside was north of North Tyneside.

Geogrid is a fantastic starting point, which can do a lot of the groundwork for you, but it seems that to make a good hexmap you need to do a certain amount of the work by hand.

To help with that, I wrote a small tool that lets you edit HexJSON data in the browser, and then export your work in both HexJSON and GeoJSON formats. Like a lot of tools I make, it doesn't have a massive feature set, but aims to do one thing well.

Editing hexmaps in the browser

The HexJSON Editor lets you import hexmap data in HexJSON format and move the hexes around by hand. Simply select the hex you want to move by clicking on it.

A grid of hexagons with one of the hexagons highlighted indicating it is selected and ready to move

And then click on the destination to place it.

The Dane grind of hexagons as shown previously but the selected hexagon has moved

If the position you place a hex is already occupied by another hex, it will swap them.

If you want to try the editor, you can use the example HexJSON grid shown above, or alternatively try the local authority hexmap, or the Open Data Institute's constituency hexmap.

When you load the HexJSON data, you can choose which variable to use for labelling. You also have the option of choosing a categorical variable to use for shading the hexes — the colours are chosen for each category using a standard categorical colour scale. Finally, if you need more space around the hexes for editing, you have the option of adding more padding.

I made the HexJSON editor mainly to meet my own mapping needs, but I thought it was worth sharing. If there is enough interest in new features I could either add them, or open source the code so other people can. In the meantime, it's there if you need it.