Skip to content
Toxic Release Inventory API - Geospatial Query Sample Application
JavaScript
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
node_modules
public/stylesheets
routes
views
README.md
app.js
config.js
data.js
load.js
package.json

README.md

Toxic Release Inventory

Sample application exposing REST API for spatial queries against document DB.

Background

Toxic Release Inventory is a data that is provided by environmental agencies across country to EPA. This application includes 10 years (2000-2010) of data that was submitted from the state of Oregon. This data was transform into a JSON document and especially enabled. The original data in CSV format can be obtained from the Oregon DEP or the national data site (http://www.data.gov/)

API

This sample application includes basic spatial and document queries. Each on of the REST API services returns a valid GeoJson (http://www.geojson.org/). KML view to come.

Sample Response

{
   "type":"FeatureCollection",
   "features":[
      {
         "_id":"4f7f2cee62720c00000002b8",
         "properties":{
            "featureName":"CHEMICAL WASTE MANAGEMENT OF THE NORTHWEST INC",
            "reportYear":2000,
            "triId":"97812CHMCL17629",
            "release":{
               "casId":"7429905",
               "docCtrlNum":"1300208884181",
               "cleanAirAct":"NO",
               "chemical":"ALUMINUM (FUME OR DUST)",
               "classification":"NON-PBT",
               "unit":"Pounds",
               "total":1913446.7
            },
            "industry":{
               "naics":"",
               "sic":"4953"
            },
            "address":{
               "zip":"97812",
               "state":"OR",
               "county":"GILLIAM",
               "city":"ARLINGTON",
               "street":"17629 CEDAR SPRINGS LN"
            }
         },
         "geometry":{
            "coordinates":[
               45.615425,
               -120.236047
            ],
            "type":"Point"
         },
         "type":"Feature"
      }
   ]
}

Sites in radius from a spatial point

Searches the spatial DB for records within certain distance from specified coordinate. Can be used to answer: I am here, what's around me?

http://tri-api.cloudfoundry.com/v.1/sites/2010/point?lat=44.519722&lng=-122.89333&rad=2.5&max=100

Arguments

lat - Valid latitude [decimal]
lng - Valid longitude [decimal]
rad - Radius [decimal]
max - Maximum number of records returned [integer]

Note: In this sample application, the spatial coordinates must be within the state of Oregon.

Sites within spatial extend

Search the spatial DB for records within spatial extend (box) defined by two sets of coordinates, Lower-left and upper-right conners of the box. Can be used to answer: What's in my current map view?

http://tri-api.cloudfoundry.com/v.1/sites/2010/box?box=44.339565,-123.925781,45.935871,-116.916504&max=1000

Arguments

box[0] - lower-left latitude [decimal]
box[1] - lower-left longitude [decimal]
box[2] - upper-left latitude [decimal]
box[3] - upper-left longitude [decimal]
max - Maximum number of records returned [integer]

Note: In this sample application, the spatial coordinates must be within the state of Oregon.

Sites reports over years

Search for annual reports for a particular TRI site by its TRI Id. Once a site is identified, all data for each reporting year for that side can be returned.

http://tri-api.cloudfoundry.com/v.1/sites/97031LHRJN400PO

TODO

While this is only a sample application, there are a few things that should be done:

  • Unit testing, yes please
  • More robust error handling
  • KML view
  • Sample app to use this API would be nice, no?
Something went wrong with that request. Please try again.