You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 46 Next »

As of January 2020 GLTG has 32,122,836 datapoints. 

WARNING Please don't fetch all of them at once.


Step 1: Create an Account 

Step 2: Acquire Data from API

You can acquire the data from API by using curl command or python library (we provide the example in jupyter notebook in attached)

Using CURL

Get all Sensors in JSON format

Currently, pulling sensors does not require authentication.

InputsOutput typeOutput Example
url

JSON

Output JSON example
{ "sensors":[

         { "id":1445,
         "name":"03254520",
         "created":"2018-03-23T15:48:32Z",
         "geoType":"Feature",
         "geometry":{ "type":"Point",
                                 "coordinates":[ -84.44799549,38.9203417,0]
         },
         "properties":{ "name":"03254520",
                                 "huc":{ "huc8":{ "code":"05100101"},
                                              "huc2":{"code":"05" },
                                              "huc4":{"code":"0510"},
                                              "huc6":{"code":"051001"},
                                               "huc_name":"Licking"
                                            },
           "region":"0510",
           "location":"LICKING RIVER AT HWY 536 NEAR ALEXANDRIA, KY",
           "type":{ 
               "title":"United States Geological Survey",
               "network":"NWIS",
               "id":"usgs"
            },
            "popupContent":"03254520",
            "online_status":"online",
            "id":1445
         },
         "min_start_time":"2007-10-01T06:00:00Z",
         "max_end_time":"2020-02-05T12:30:00Z",
         "parameters":[ 
            "discharge-ft3s",
            "discharge-ft3s-qc",
            "dissolved-oxygen-mgl",
            "dissolved-oxygen-mgl-qc",
            "nitrate-nitrite-as-n-mgl",
            "nitrate-nitrite-as-n-mgl-qc",
            "pH",
            "pH-qc",
            "specific-conductance-uScm",
            "specific-conductance-uScm-qc",
            "turbidity-fnu",
            "turbidity-fnu-qc",
            "water-temperature-c",
            "water-temperature-c-qc"

            ],

            ....

    ]

}}


Get all Sensors
curl -X GET --compressed https://greatlakestogulf.org/geostreams/api/sensors


Authenticate

InputsOutputDetails
  • url
  • email
  • password
X-Auth-TokenUse the token for fetching datapoints




Authenticate
curl -X POST -H 'Content-Type: application/json' -d '{"password": "****", "identifier": "email"}' --compressed -i https://greatlakestogulf.org/geostreams/api/authenticate


Get all Datapoints for Single Sensor

We request that a user not try to pull all datapoints concurrently.  It is preferred that datapoints be pulled in series by sensor id.

InputsOutput TypeDetailsExample Return
  • token
  • sensor_id
  • since
JSONUse X-Auth-Token from authentication


Example Output
[    

    { "id":96556536,
      "created":"2019-09-27T20:45:42Z",
      "start_time":"2018-06-25T00:00:00Z",
      "end_time":"2018-06-25T00:00:00Z",
      "properties":{ 
         "nitrate-nitrite-inorganic-total-as-n-mgl":"4.16"

       },
      "type":"Feature",
      "geometry":{          "type":"Point",
         "coordinates":[ -90.645,42.5408333,0 ]
       },
      "stream_id":"28",
      "sensor_id":"22",
      "sensor_name":"IL_EPA_WQX-M-13"
   },
  ...
]


Get Datapoints for Single Sensor
curl -X GET -H 'Content-Encoding: application/json' -H 'x-auth-token:token' --compressed 'https://greatlakestogulf.org/geostreams/api/datapoints?sensor_id=22&since=2018-06-01'


Using Python Requests


Using Python Library (pyGeotemporal)

Install pyGeotemporal

It is recommended to use a virtual environment for python.

pyGeotemporal
git clone ssh://git@opensource.ncsa.illinois.edu:7999/geod/pygeotemporal.git
cd pygeotemporal
python setup.py install



<< insert code example here>>

<< need to have instruction how to get pyGeotemporal >>




Jupyter Notebook 

Jupyter notebook example can be download here geostreams_jupyter.ipynb







  • No labels