Importing Maps

Alec Ramsay
Dave’s Redistricting
6 min readAug 25, 2021

While many users like to explore redistricting by starting from a blank map and painting districts from scratch, often you would like to import some existing or proposed map so you can explore it more deeply using DRA 2020 analytics, compare it to other maps either visually or analytically or use it as a starting point to make your own changes.

The easiest way to “import” a map so you can edit it is to find an existing map that is already in DRA 2020, e.g. one that is in the Official or Published map categories or one that has been shared with you and then Duplicate it. You can choose Duplicate from the command bar in the list of maps or you can select the Paintbrush icon when viewing a read-only map and you will receive a prompt asking if you want to duplicate that map. When you duplicate a map, you get your own editable version of the map that shows up in your “My Maps” list.

In other cases, you have some file that describes the map using some interchangeable format. There are two different paths here based on the type of format you have available.

The most universal and precise format is a block assignment file. This is a text file containing a series of lines where each line contains a census block ID, followed by a comma, followed by a district number or label. (We also support files that separate the block ID and district number using the “|” character since that is common in Census Bureau-generated files.) The block ID may look like a number but is actually a string — so be careful loading it into tools like Microsoft Excel that automatically convert number-like text into actual numbers and might change the format in ways that can corrupt the file. In particular, 7 states have block ID’s that start with the digit “0” and Excel will remove that leading “0” which effectively corrupts the data. If you do have to edit such a file, your best bet is to use a simple text editor.

The other type of format is a file that describes the district shapes as a series of polygons. We support two different formats, the ESRI Shapefile format or the GeoJSON format. Shapefile is actually a multi-file format so normally comes in the form of a zip archive (extension .zip) and that is the only way we accept them for import. Shapefile has many different character encoding and geographic projection options and we do not support them all. If you are having trouble importing a Shapefile, your best bet is to use some free tool (like Mapshaper) to convert the Shapefile into GeoJSON which has many fewer options and is better supported in DRA 2020.

If you simply want to draw the shapes over some set of existing maps, the easiest mechanism is to import the shapes as a Custom Overlay, which is fully described in Using Custom Overlays. An advantage of an overlay is that it does not need to be mapped to the underlying Census blocks and precincts. This can be important if the overlay is showing an area that is defined in a way that is unrelated to Census granularity (e.g. a map showing the watersheds in an area).

The disadvantage of a simple overlay is that it is not a map! A map can be analyzed, modified, compared, shared, published and also overlaid on other maps using Custom Overlays. So there are a lot of reasons why you might want to take that set of shapes and turn them into a map. When converting a set of shapes in either Shapefile or GeoJSON format into a map, each shape is assigned to a different district with a label that is pulled from the shape properties (if there is no such property, we just number them starting at 1). The import code figures out which state is covered by the shapes and creates a map for that state with a separate district for each shape.

The process of importing looks at each census block in the state and tries to assign it to a shape from your file. Typically, the shapes we see have been simplified using some algorithm in order to reduce the file size and reduce processing costs. This simplification process means that our assignment of blocks to shapes is almost always approximate and can sometimes assign a block to a different district than it was assigned to in the original full-fidelity source map (which is the most important reason that a block assignment file is a better choice for import if you can find one).

After you import using shapes, it is good practice to look at your map for any of these anomalies. It often occurs for small, narrow or twisting blocks and if present, will occur at the boundaries of a district. One good strategy after importing is to import the original shapes as a Custom Overlay and visually scan for any anomalies. You might also use other tools from the Tools menu to look for unintended unassigned, split or discontiguous precincts.

The Importing Process

The above description focused on the formats we accept. This section talks about the actual process of doing an import. There are two basic approaches to import:

  • You can import from the top level of DRA 2020, creating a new map in your My Maps list.
Top-level Import Command
  • You can open an existing map, open map properties (the cog-shaped button in the top-right), and use the Color Map From File tool.
Color Map from File Control

Each approach has its pluses and minuses. The top level import is simple and straight-forward; you provide a file and you get a map. However, you have little control over map settings (although you can open the map and adjust settings after the map is imported). Also, the processing happens on the service and you get little feedback about how it is proceeding. It is also susceptible to timing out and failing, especially for very large states like Texas and California.

Color Map From File happens on the client and provides ongoing feedback about progress. It also won’t time out (although you can cancel the processing) so it might be a better choice for large states. It only assigns precincts and defines districts but doesn’t change any other map settings that have already been set up. So if you have a map that is already set up the way you like, a common process is to duplicate that map and then use Color Map From File to specify the districts and precinct assignments.

Some More Details

There are a few other details that you might want to understand.

  • When importing block assignments from the top level, you need to specify whether you want to use 2020 shapes or the older 2010 shapes. For the current redistricting process, you are almost always dealing with 2020 block IDs and so should use 2020 shapes. When using Color Map from File, the shapes to use were specified when you created the map and cannot be specified during this import process. If import fails for a block assignment file, you might try changing that checkbox (or create a new map that uses the alternate shape set if using Color Map from File).
  • We actually support both block assignment and precinct assignment files. A precinct assignment file is typically much smaller than a block assignment file but is slightly less interoperable with other tools. Precinct IDs vary between states and are typically either voting tabulation districts (VTDs), block groups, or some combination of VTDs and minor civil divisions. Typically you would only import precinct assignment files that you had previously exported from DRA 2020 for external processing or analysis. When DRA 2020 exports a precinct assignment file, it generates only a single line for each whole precinct but specifies all the block IDs for any precincts that have been split using the block painting tool.
  • We support two different archive formats. An archive format is useful to to extract your data from DRA 2020 in order to preserve it in some external system. It is typically only useful as a format to re-import it into DRA 2020 later. An archive exported from DRA 2020 is a JSON file (.json) and can then be re-imported. We also support archive files from DRA 2.2 (.drf).
Top-level Import Dialog

Already Imported Proposed Maps

If you’re trying to import a newly released proposed map for a state, the Redistrict 2020 site might have already done that for you.

--

--

Alec Ramsay
Dave’s Redistricting

I synthesize large complex domains into easy-to-understand conceptual frameworks: I create simple maps of complex territories.