/ma-legislature

Geographic data for the Massachusetts legislature

Primary LanguageHTMLCreative Commons Zero v1.0 UniversalCC0-1.0

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.