@d3ts/us-atlas

Pre-built TopoJSON from the U.S. Census Bureau, including Insular Areas.

Usage no npm install needed!

<script type="module">
  import d3tsUsAtlas from 'https://cdn.skypack.dev/@d3ts/us-atlas';
</script>

README

US Atlas TopoJSON

This repository is a fork of TopoJSON's US Atlas. As with the TopoJSON repository, it provides a convenient redistribution of the Census Bureau’s cartographic boundary shapefiles as TopoJSON. The current release uses the 2019 edition shapefiles. Both projected and unprojected geometries are included. The projection used by these files is:

d3ts.usMapProjection();

The base projection uses d3.geoAlbersUsa(), but designed to fit a 1024×576 widescreen viewport, rather than d3's default 1024×576. Additionally, the projected and unprojected files includes objects for all states and insular areas, including Alaska and Hawaii, plus Puerto Rico, US Virgin Islands, American Samoa, Guam, and the Northern Mariana Islands – insular areas are not present in d3's version. Detailed documentation for the projection is available here.

Finally, this distribution ships with an additional topojson file with convenient outlines for each of the inset areas (only available as a projected file), plus some addiitonal state metadata for labelling.

Details on all included files can be found in the file reference section below.

Usage

These files were designed for use with d3ts US Map tools. For a browser example see:
https://observablehq.com/@bratter/us-map.

It can also be used as a drop-in replacement for TopoJSON's US Atlas, so all the examples work as expected:

In a browser, using d3-geo and SVG:
https://observablehq.com/@d3/u-s-map

In a browser, using d3-geo and Canvas:
https://observablehq.com/@d3/u-s-map-canvas

In Node, using d3-geo and node-canvas:
https://bl.ocks.org/mbostock/885fffe88d72b2a25c090e0bbbef382f

File Reference

# counties-10m.json · Download

A TopoJSON file containing the geometry collections counties, states, and nation. The geometry is quantized and simplified, but not projected. This topology is derived from the Census Bureau’s cartographic county boundaries, 2019 edition. The state boundaries are computed by merging counties, and the nation boundary is computed by merging states, ensuring a consistent topology.

# counties-albers-10m.json · Download

A TopoJSON file containing the geometry collections counties, states, and nation. The geometry is quantized, projected using d3ts.usMapProjection to fit a 1024×576 viewport, and simplified. This topology is derived from the Census Bureau’s cartographic county boundaries, 2019 edition. The state boundaries are computed by merging counties, and the nation boundary is computed by merging states, ensuring a consistent topology.

# states-10m.json · Download

A TopoJSON file containing the geometry collections states and nation. The geometry is quantized and simplified, but not projected. This topology is derived from the Census Bureau’s cartographic state boundaries, 2019 edition. The nation boundary is computed by merging states, ensuring a consistent topology.

# states-albers-10m.json · Download

A TopoJSON file containing the geometry collections states and nation. The geometry is quantized, projected using d3ts.usMapProjection to fit a 1024×576 viewport, and simplified. This topology is derived from the Census Bureau’s cartographic state boundaries, 2019 edition. The nation boundary is computed by merging states, ensuring a consistent topology.

# nation-10m.json · Download

A TopoJSON file containing the geometry collection nation. The geometry is quantized and simplified, but not projected. This topology is derived from the Census Bureau’s cartographic nation boundary, 2019 edition.

# nation-albers-10m.json · Download

A TopoJSON file containing the geometry collection nation. The geometry is quantized, projected using d3ts.usMapProjection to fit a 1024×576 viewport, and simplified. This topology is derived from the Census Bureau’s cartographic nation boundary, 2019 edition.

# outlines-albers-10m.json · Download

TopoJSON file containing the geometry collection outlines. The geometry is quantized and projected using d3ts.usMapProjection to fit a 1024×576 viewport. This collection provide convenient outlines for each of the five insets for AK, HI and the insular areas. There are five outline geometries with the following string ids:

  • "02" - Alaska
  • "15" - Hawaii
  • "60" - American Samoa
  • "66,69" - Guam and the Northern Mariana Islands
  • "72,78" - Puerto Rico and the US Virgin Islands

Note that the last two insets cover two entities each PR/VI and GU/MP respectively. Geometries can be filtered using the id, or the four attached properties:

  • outline.properties.name - the name, shown above
  • outline.properties.fips - array of two-digit FIPS codes as strings, similar to the ids above, but split into an array
  • outline.properties.codes - array of two-digit state lstter codes, such as ["AK"]
  • outline.properties.type - the type of entity covered by the outline, can be "state", or "insular area"

The suggested use for this file is to filter for the desired insets and mesh using TopoJSON's mesh:

const mesh = topojson.mesh(outlines, outlines.objects.outlines);
const path = d3.geoPath()(mesh);

# state-metadata.json · Download

A JSON file containing some simple metadata for US States and Insular Areas. One entry is provided for each of the 50 States, Washington DC, 6 Insular Areas, and 3 Freely Associated States. Note that the projections above do not include the Freely Associated States or the US Minor Outlying Islands, but they are included here. Keys provided are:

  • entity.id - the two-digit FIPS code for the entity, such as "06"
  • entity.name - the official name for the entity, such as "California"
  • entity.code - the two alphabetical code for the entity, such as "CA"
  • entity.abbrev - the AP abbreviation for the entity, such as "Calif."
  • entity.type - the legal status of the entity, such as "state"

This data is used to generate properties in the TopoJSON files, but provided separately for convenience.

# us.objects.counties

Each county has three fields:

  • county.id - the five-digit FIPS county code, such as "06069"
  • county.properties.name - the county name, such as "San Benito"
  • county.properties.state - the two-letter state code, such as "CA"

The first two digits of the county FIPS code is the state FIPS code.

# us.objects.states

Each state has five fields:

  • state.id - the two-digit FIPS state code, such as "06"
  • state.properties.name - the state name, such as "California"
  • state.properties.code - the state's two-letter identifier, such as "CA"
  • state.properties.abbrev - the state's AP abbreviation, such as "Calif."
  • state.properties.type - the legal type of the entity, such as "state", DC is noted as "federal district", and "insular areas" are also provided

# us.objects.nation

The nation has two fields:

  • nation.id - the string "US"
  • nation.properties.name - the string "United States"