HexJSON format

We want to make sharing hexagon-based maps - such as our UK constituency hex map - easy. We've defined a simple JSON format to achieve that. The format is:

{
	"layout": "odd-r",
	"hexes": {
		"E14000530":{"q":-3,"r":-11},
		"E14000531":{"q":-3,"r":-1}
	}
}

The layout property should be one of the following coordinate systems (row number increasing vertically):

Note: the shifts in each coordinate system are based on the absolute column/row numbers as specified in the HexJSON file, not on their relative position in a layout. Using absolute numbers ensures that a layout still renders correctly if a column or row is added later.

The hexes are then defined using unique keys for each. Every hex is positioned by providing column (q) and row (r) coordinates. You don't have to start at 0,0.

You can add your own custom data fields to each hex if you want to. Just make sure you don't use the keys q and r as they will be the coordinates e.g.

{
	"layout": "odd-r",
	"hexes": {
		"E14000530":{
			"name": "Aldershot",
			"q": -3,
			"r": -11,
			"area": "SE",
			"NUTS1": "UKJ",
			"electorate": 72430
		},
		"E14000531":{
			"name": "Aldridge-Brownhills",
			"q": -3,
			"r": -1,
			"area": "WM",
			"NUTS1": "UKG",
			"electorate": 60215
		}
		...
	}
}

Using HexJSON

The format is JSON so should be easy to ingest by your favourite programming language. We'll add examples that people have created below.