Geographic Files
JSON Adjacency Files
These are the basic format used to hold the Adjacency file or dual graph for a region to be redistricted. It is based on the JSON output of the NetworkX Python library. An example for a 4x4 grid here grid_graph_4_by_4.json.
Such a file contains list of the nodes/vertices as a list under node. A sample node entry is
{
"node_name": "(0,0)",
"id": 0,
"border_length": 2,
"x_location": 0,
"y_location": 0,
"area": 1,
"population": 1,
"county": "A"
}where the id, area, population and border_length are required. They give the name by which the vertex/node are referred to as well as the area and population of the partition unit associated to the vertex/node. border_length entry give the length of the external boundary of the partition unit associated to the vertex/node. Hence if a vertex/node is interior this number is zero. The precise labels can be different than these as the name mapping to each piece of data can be specified at runtime.
One can also encode additional information. This example gives a node name in node_name, a location in the plane to help with plotting in x_location and y_location. It also records which county the node is in. This example uses fictitious county names of “A” and “B”. Additionally, the vote count for each party in a collection of elections is also often included.
After the list of nodes, there is an adjacency entry which contains one list for each of the vertices/nodes. The first list under adjacency gives the vertices/nodes that are adjacent to the first vertex/node listed above.
For example of the second entry in the adjacency list is the following list, then the 2nd node is adjacent to the 4th and 5th node listed with a boundary whose length is respectively one and two units.
{
{
"id": 4,
"length": 1
},
{
"id": 5,
"length": 2
}
}Example files
| Description | File Name | Comments |
|---|---|---|
| 4x4 Rectangular Grid | grid_graph_4_by_4.json | Simple regular graph. All nodes have area and population 1. Grid divided into two counties labeled “A” and “B” |
| 8x8 Rectangular Grid | grid_graph_8_by_8.json | 8x8 version of previous. |
| 10x10 Rectangular Grid | grid_graph_10_by_10.json | 10x10 version of previous. |
| 15x15 Rectangular Grid | grid_graph_15_by_15.json | 15x15 version of previous. |
| 20x20 Rectangular Grid | grid_graph_20_by_20.json | 20x20 version of previous. |
| 30x30 Rectangular Grid | grid_graph_30_by_30.json | 30x30 version of previous. |
| 40x40 Rectangular Grid | grid_graph_40_by_40.json | 40x40 version of previous. |
| 50x50 Rectangular Grid | grid_graph_50_by_50.json | 50x50 version of previous. |
| 20x80 Rectangular Grid | grid_graph_20_by_80.json | 20x80 version of previous. |
| 25x100 Rectangular Grid | grid_graph_25_by_100.json | 25x100 version of previous. |
| 10x10 Hexagonal Grid | hex_graph_10_by_10.json | The graph is now hexagonal rather than square. Each node in the interior has 6 neighbors. This is the dual graph of a region partitioned into triangles. |
| 15x15 Hexagonal Grid | hex_graph_15_by_15.json | 15x15 version of previous. |
| 20x20 Hexagonal Grid | hex_graph_20_by_20.json | 20x20 version of previous. |
| 30x30 Hexagonal Grid | hex_graph_30_by_30.json | 30x30 version of previous. |
| 40x40 Hexagonal Grid | hex_graph_40_by_40.json | 40x40 version of previous. |
| 50x50 Hexagonal Grid | hex_graph_50_by_50.json | 50x50 version of previous. |
| 20x80 Hexagonal Grid | hex_graph_20_by_80.json | 20x80 version of previous. |
| 25x100 Hexagonal Grid | hex_graph_25_by_100.json | 25x100 version of previous. |
| Connecticut Adjacency Graph | CT_pct20.json | Precinct Adjacency Graph of the state of Connecticut. Contains county names in COUNTY, Precinct name in NAME, 2020 Population in POP20, area and border length in area and border_length, party votes from 2020 presidential general election in G20PREDEM and G20PREREP. There is also an associated shapefile here. |
| North Carolina Adjacency Graph | NC_pct21.json | Precinct Adjacency Graph of the state of North Carolina. The population is given in pop2020cen, the area by area, and edge length by length. The name in prec_id is not unique, but it is when combined with the county label. The id labl is a unique identifier of precincts. This JSON also holds a large amount of extra data including BVAP2020ce and VAP2020cen as well as many election vote counts. City information is also given in MCD. There is also an associated shapefile here. |
| Ohio Adjacency Graph | OHpct20.json | Precinct Adjacency Graph of the state of Ohio. The population is given in POP20, the area by area, and edge length by border_length. The name in NAME is unique. The id label is a unique identifier of precincts. This JSON also holds one set of election vote counts. There is also an associated shapefile here. |
Code to generate Grid and Hex Graph JSON files
The code to generate the grid_graph_8_by_8.json graph file and the other regular graph JSON files listed above can be found here: generateGridAndHexGraphs.ipynb . It is a Python notebook.
Shapefiles
The shapefile format is a geospatial vector data format for geographic information system (GIS) software. It was developed and regulated by Esri and is used to transfer data between many GIS systems. While the actual shape file has the extension .shp there are also two other required files with the extensions .shx and .dbf. All three are often zipped together into one file and called the “shapefile”. There are tools for creating a JSON adjacency file from a shapefile though a fair bit of cleaning is required.
| Region | file | Description |
|---|---|---|
| CT | shapefile_CT.zip | |
| NC | northCarolinaPrecinct2021.zip | |
| OH | pctSF_OH.zip |
GeoJSON
GeoJSON is a file formate that is the primary open source alternative to the shapefile format.