Git Product home page Git Product logo

clean-air-compass-geojson-fastapi's Introduction

Clean Air Compass - Mapping API - Serverless Version

An API to handle location requests from the Clean Air Compass frontend and return an interpolated map of air pollution (PM 2.5) in the form of a list of georeferenced polygons.

Details

The API conducts the following steps:

  • Parses the location request to see if it is for a city or a US postal code
  • Makes a request to the LocationIQ API and get back a bounding box of lat / lon coordinates
  • Makes a request to the Purple Air API to get back the list of sensors within the bounding box as well as their associated air pollution data
  • Creates a spatial data frame from the sensor API response object using shapely
  • Creates a grid of polygons based on the spatial extent of the collection of sensor points and estimates the PM 2.5 pollution at each grid cell using the K-nearest neigbors (KNN) regressor method.
  • Returns the grid of polygons to the frontend as a GeoJSON object

How to run

  1. Clone the repo
  2. Install all dependencies by running pip install -r requirements.txt in the console
  3. Create your own environment file where you set the values for your own Location IQ API key (LOC_IQ_KEY) and Purple Air API key (API_KEY) respectively.
  4. Run the API server locally using uvicorn main:app --reload

clean-air-compass-geojson-fastapi's People

Contributors

dennis-nichols avatar oliverspeir avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.