Skip to content

Latest commit

 

History

History
316 lines (287 loc) · 8.36 KB

api.markdown

File metadata and controls

316 lines (287 loc) · 8.36 KB
layout title page_title image header-class
page
API
API
api.jpg
dark-image

Use our free API for accessing SNOTEL station data. Our API is useful for finding current snow levels in mountainous regions across the United States. All endpoints accept a callback parameter for JSONP and don't require authentication.

Over 800 SNOTEL stations are available:

Select a station above to see snow levels here

Get all SNOTEL stations

Description:
Returns basic information about all of the SNOTEL stations in the United States.

Endpoint: /stations

Request parameters:

Parameter Descriptions
None None

Response parameters:
The response comes as an array of objects. Here is a breakdown of a returned object.

Parameter Descriptions
Elevation (integer) Elevation of the station in feet
Location (lat, lng object) Latitude and longitude of the station
Name (string) Name of the station in ALL CAPS
Triplet (string) Unique identifier for the station. Formatted as ::SNTL
Wind (boolean) Indiciates whether or not the station is equiped with a wind sensor

Sample call: http://api.powderlin.es/stations

Sample response:

[
    {
        "elevation":8777,
        "location": {"lat":40.8852,"lng":-110.8277},
        "name":"BEAR RIVER RS",
        "timezone":-7,
        "triplet":"992:UT:SNTL",
        "wind":false
    },
    {
        "elevation":5130,
        "location":{"lat":46.78265,"lng":-121.74765},
        "name":"PARADISE",
        "timezone":-8,
        "triplet":"679:WA:SNTL",
        "wind":false
    },
    {
        ...
    }
]

Get snow info for a station

Description:
Returns detailed information for the specified SNOTEL station.

Endpoint: /station/:id

Request parameters:

Parameter Description
ID (triplet) Station id in the form of ###:STATE:SNTL. Example: 791:WA:SNTL. Find the triplet for a particular station through the /stations endpoint.
Days (integer) Number of days information to retrieve from today. (optional)
Start date (YYYY-MM-DD) Historical date to pull data from. Use in conjunction with end date. (optional)
End date (YYYY-MM-DD) Historical date to pull data from. Use in conjunction with start date (optional)

Response parameters:
The response includes basic station information in addition to an array of snow data.

Parameter Description
Date Date measurement was taken
Snow Water Equivalent (in) The amount of water contained within the snowpack.
Change In Snow Water Equivalent (in) The change in the snow water equivalent from the last measurement (typically the past 24 hours).
Snow Depth (in) Depth of snow in inches.
Change In Snow Depth (in) The change in the snow depth from the last measurement (typically the past 24 hours).

Sample calls: http://api.powderlin.es/station/791:WA:SNTL?days=20 http://api.powderlin.es/station/791:WA:SNTL?start_date=2013-01-15&end_date=2013-01-15

Sample response:

{
    "station_information":
        {
            "elevation":3950,
            "location": {"lat":47.74607,"lng":-121.09288},
            "name":"STEVENS PASS",
            "timezone":-8,
            "triplet":"791:WA:SNTL",
            "wind":false
        },
    "data": [
        {
            "Date":"2014-06-30",
            "Snow Water Equivalent (in)":"0.0",
            "Change In Snow Water Equivalent (in)":"0.0",
            "Snow Depth (in)":"0",
            "Change In Snow Depth (in)":"0"
        },
        {
            "Date":"2014-07-01",
            "Snow Water Equivalent (in)":"0.0",
            "Change In Snow Water Equivalent (in)":"0.0",
            "Snow Depth (in)":"0",
            "Change In Snow Depth (in)":"0"
        },
        {
            ...
        }
    ]   
}

Find closest station to a latitude and longitude:

Description:
Returns detailed information for the closest SNOTEL stations to a geographic point.

Endpoint: /closest_stations

Request parameters:

Parameter Description
lat (float) Latitude to base search off of. (required)
lng (float) Longitude to base search off of. (required)
data (boolean) Setting to true will enable fetching of snow info from the stations. Note that this might be slow depending on the number of stations you're requesting information from.
days (integer) Number of days information to retrieve from today. (optional)
count (integer) number of station's to return (optional - defaults to 3, maximum of 5)

Response parameters:
The response is an array of stations including their basic information in addition to an array of snow data.

Parameter Description
Date Date measurement was taken
Snow Water Equivalent (in) The amount of water contained within the snowpack.
Change In Snow Water Equivalent (in) The change in the snow water equivalent from the last measurement (typically the past 24 hours).
Snow Depth (in) Depth of snow in inches.
Change In Snow Depth (in) The change in the snow depth from the last measurement (typically the past 24 hours).

Sample call: http://api.powderlin.es/closest_stations?lat=47.3974&lng=-121.3958&data=true&days=3&count=3

Sample response:

[
    {
        "station_information":
            {
                "elevation":3950,
                "location": {"lat":47.74607,"lng":-121.09288},
                "name":"STEVENS PASS",
                "timezone":-8,
                "triplet":"791:WA:SNTL",
                "wind":false
            },
        "data": [
            {
                "Date":"2014-06-30",
                "Snow Water Equivalent (in)":"0.0",
                "Change In Snow Water Equivalent (in)":"0.0",
                "Snow Depth (in)":"0",
                "Change In Snow Depth (in)":"0"
            },
            {
                "Date":"2014-07-01",
                "Snow Water Equivalent (in)":"0.0",
                "Change In Snow Water Equivalent (in)":"0.0",
                "Snow Depth (in)":"0",
                "Change In Snow Depth (in)":"0"
            },
            {
                ...
            }
        ]   
    },
    {
        ...
    }
]

Want to help out?

The source for the API is available at https://github.com/bobbymarko/powderlines-api.

To run the API locally:

  1. Clone the git repository
  2. Run "bundle install"
  3. Run 'rackup'
  4. Navigate to http://localhost:9292 in your browser

Feedback

Let us know if you have any questions or concern. Email Bobby

<script src="/assets/js/api-docs.js"></script>