Docs › Examples › U.S. state map

U.S. state map

Difficulty: easy

U.S. States

Steps

  1. Load state/province polygons (source: Natural Earth)
  2. Keep only U.S. states
  3. Project to the "Albers USA" projection
  4. Assign random, non-adjacent colors
  5. Add a stroke to borders between two states
  6. Export as SVG

Code

mapshaper \
-i ne_50m_admin_1_states_provinces_lakes.geojson name=states \
-filter 'admin == "United States of America"' \
-proj albersusa \
-classify non-adjacent colors=Tableau10 \
-innerlines + name=innerlines \
-style stroke=white stroke-width=0.5 \
-target states,innerlines \
-o us-states.svg height=400 width=600

Notes

  • To see the list of built-in color schemes to use with -classify, run mapshaper -colors. You can also use colors=random.
  • The Albers USA projection (-proj albersusa) is a custom projection used by The New York Times for U.S. maps.
  • Applying a stroke to interior lines using -innerlines (and not to exterior lines) creates a more accurate and crisper-looking coastline.

Assets