Skip to content

curatedcode/merge-shapefiles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Census Map Maker

A powerful tool that combines census tract data with demographic information and legislative districts to create rich, insightful geospatial visualizations.

📋 Overview

Census Map Maker helps you create detailed visualizations by merging:

  • Census tract boundaries
  • Demographic data from the American Community Survey (ACS)
  • Legislative district boundaries (senate, house, etc.)

This allows for powerful analysis of population distribution, demographic patterns, and how they relate to electoral districts.

🚀 Future

  • Add support for multiple demographic files at once
  • Add more configuration options

🛠️ Prerequisites

  • Node.js (version 14+)
  • pnpm package manager
  • Basic understanding of GeoJSON data

📊 Data Sources

1. Census Tracts

Download from the U.S. Census Bureau:

2. Demographic Data

Download from the Census Bureau's data portal:

  • URL: https://data.census.gov/table/ACSDP5Y2022.DP05?q=Age+and+Sex
  • Important: Use the same year as your Census Tract data
  • Must use a 5-year ACS (American Community Survey) dataset
  • Configuration steps:
    1. Under "Geos" select: Census Tracts → [YOUR STATE] → "All Census Tracts within [STATE]"
    2. Click "More Tools" → "ZIP"
    3. Find the "ACS 5-Year Estimates Data Profiles" row
    4. Select the column matching your year
  • Save as DEMOGRAPHICS.csv in the data/prepare folder

3. Legislative Districts

📁 File Structure

data/
├── prepare/             # Place input files here
│   ├── CENSUS_TRACTS.zip
│   └── DEMOGRAPHICS.csv
├── start/               # District data and processed files
│   └── DISTRICTS.json
└── examples/            # Reference data samples

🚀 Usage

Step 1: Prepare the data

Run the data preparation script:

pnpm prepare

This will:

  • Extract and process census tract boundaries
  • Merge demographic data with census tracts
  • Generate POPULATED_CENSUS_TRACTS.json

Note: The script may report that 1-2 records couldn't be joined. This is normal and usually refers to CSV headers that can be safely ignored.

Step 2: Create the final visualization

Run the main processing script:

pnpm start

This script will:

  • Merge the populated census tracts with district boundaries
  • Generate the final GeoJSON output file

Note: This process may take some time depending on the amount of polygon coordinates in your data.

🔍 Example Data

The repository includes example data in the /data/examples folder to help you understand the expected format and structure of input and output files.

📊 Visualization

Once processing is complete, you can visualize the resulting GeoJSON using Mapshaper.org

🤝 Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the issues page.

📝 License

MIT License

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published