Skip to content
main
Switch branches/tags
Go to file
Code

Latest commit

 

Git stats

Files

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

README.md

Issues

  • Tracked in our central issue repository: Geo Issues

Open States Geography Processing & Server

Generate and upload map tiles for the state-level legislative district maps on openstates.org, both for state overviews and for individual legislators.

  • Source: SLDL and SLDU shapefiles from the Census's TIGER/Line database
  • Output: a single nationwide MBTiles vector tile set, uploaded to Mapbox for hosting
    • Intermediate files are also built and retained locally, stored in the data directory for debugging

Dependencies

  • Python 3 and poetry
  • GDAL 2
  • curl
  • tippecanoe
  • unzip

Running

There are several steps, which typically need to be run in order:

  1. Setup Poetry:

poetry install

  1. Download SLD shapefiles:

poetry run ./scripts/get-all-sld-shapefiles.py

  1. Convert to geojson with division IDs:

poetry run ./scripts/to-geojson.py

  1. Import into database:

poetry run ./manage.py load_divisions

  1. Convert to mbtiles and upload:

./scripts/make-tiles.py

The MAPBOX_ACCOUNT name and MAPBOX_ACCESS_TOKEN (with upload privileges) must be set as environment variables. If not, then the upload step will be skipped.

Running within Docker

Instead of setting up your local environment you can instead run using Docker. Using Docker Compose will still allow you to access all intermediate files from the processing, within your local data directory.

Build and run with Docker Compose. Similar to running without Docker, the MAPBOX_ACCOUNT and MAPBOX_ACCESS_TOKEN must be set in your local environment.

docker-compose up make-tiles

About

Source for state legislative district map tiles for openstates.org

Topics

Resources

License

Releases

No releases published

Packages

No packages published