Rest API for the EPA's Emissions & Generation Resource Integrated Database
Supports searching by Geolocation (latitude / longitude) via GeoDjango / PostGIS
Currently using 2020 data, new 2021 data was just released and will be supported soon
/api/plants
serves up a paginated list of all the plants in the database/api/plants/?lat=LAT&lng=LNG&rad=DIST
the plants endpoint supports query parameters for finding all plants within a radius of a latlong point
pip install -r requirements.txt
This app was built/tested with Python 3.11.1
This app was built to deploy to Fly.io
- Install PostGIS or run a docker image of it, taking note of any password you set on it.
- If you installed PostGIS, don't forget to run the
CREATE EXTENSION
SQL statements on the database enable PostGIS - If you're deploying to Fly.io, you'll need to connect to the database to run these extensions
- If you installed PostGIS, don't forget to run the
- Set Environmental Variables
EGRID_SERVER_DJANGO_SECRET_KEY
– used by Django to encrypt session keysDATABASE_URL
– used by Django to find and connect to the PostGIS backend. Fly.io will set this environment variable automatically when you runfly launch
and setup a postgres database. For details on the URL format, see the dj-database-url docs
python manage.py migrate
to run migrations and populate the database with the Egrid databasepython manage.py runserver
to start the server