diff --git a/hexjson.html b/hexjson.html index 3a6acea2..082aa9c2 100644 --- a/hexjson.html +++ b/hexjson.html @@ -31,25 +31,60 @@

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:

+

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 idea behind the format is that the layout is preserved, such that if for instance you have a map of the UK in HexJSON format, + you can understand the orientation of the hex coordinates by reading the JSON. The JSON will provide all information necessary to determine + the orientation and layout of the graph. +

+ +

The format is:

{
+	"version": "1.0",
 	"layout": "odd-r",
+	"minCoordinates": "right-top",
 	"hexes": {
 		"E14000530":{"q":-3,"r":-11},
 		"E14000531":{"q":-3,"r":-1}
 	}
 }
-

The layout property should be one of the following coordinate systems:

+

The version property follows the semantic versioning 2.0.0 standard. + We only use major and minor version numbers. If the version property is missing, it is assumed to be "1.0" as this JSON scheme is already used in production. +

+ +

The layout property should be one of the following coordinate system layouts:

+ +

The minCoordinates property defines the corner of the map where both axes reach their minimum value. + If the minCoordinates is left-bottom, for instance, the hexagons with the lowest q-coordinate are on the leftmost part of the map, + and the hexagons with the lowest r-coordinate are on the bottom part of the map. While a displaying agent may choose to revert or rotate the map, + at least the intention of the designer of the map is made clear by using the minCoordinates property. + This property usually matches the origin of the graph (0,0), except in axial coordinate system layouts. +

+

+ The minCoordinates should be one of the following values:

-

The hexes are then defined using unique keys for each. Every hex is positioned by providing column (q) and row (r) coordinates.

+ If there is no defined minCoordinates, the assumption is that it is left-bottom, which is the standard position of the origin in graphs. + Please note that this differs from the coordinate system layouts description, + which uses left-top minCoordinates. +

+ +

Finally, the hexes are defined using unique keys for each. Every hex is positioned by providing column (q) and row (r) coordinates.

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.

{
+	"version": "1.0",
 	"layout": "odd-r",
+	"minCoordinates": "right-top",
 	"hexes": {
 		"E14000530":{
 			"name": "Aldershot",
@@ -70,10 +105,12 @@ 

HexJSON format

... } }
+

Note that with the minCoordinates for q and r in the right-top, the Aldershot location is much lower than the Aldridge-Brownhills location, + and both are to the left of the center of the map (assuming the center is located at at 0,0). +

-