Skip to content

bhrutledge/ma-legislature

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Massachusetts Legislature Data

The dist/ directory contains GeoJSON files of the House and Senate districts with legislator information, and a JSON file of just the legislator information.

See https://bhrutledge.com/ma-legislature for a map built with Leaflet, hosted on GitHub Pages. Hopefully this can serve as an example for similar maps.

CAVEAT: I have no GIS training; I'm just a software engineer who likes maps. So, it's very likely there are some best practices that I have not, well, practiced. For example, to reduce the file size, I made some judgment calls to simplify the district borders. See the Makefile for details.

Feedback welcome on the issue tracker.

Generating the data

Install the project's dependencies:

npm install
python3 -m venv venv
venv/bin/pip install -r requirements.txt

Then, to re-download the data and rebuild the output, run:

make -B

This will:

NOTE: When scraping, the HTTP requests are cached to facilitate development and avoid excessive traffic. To re-scrape the data, delete cache/ma_legislators_requests.sqlite.

Building the map

Install the dependencies:

npm install

Run the development server:

npm start

View the map at http://localhost:3000.

Publish changes by pushing them to the main branch.