Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NWS Forecast API #1746

Open
abkfenris opened this issue Feb 9, 2022 · 0 comments
Open

NWS Forecast API #1746

abkfenris opened this issue Feb 9, 2022 · 0 comments

Comments

@abkfenris
Copy link
Member

Docs: https://www.weather.gov/documentation/services-web-api#/default/gridpoint_forecast

From lat, lon: https://api.weather.gov/points/39.7456,-97.0892

{
    "@context": [
        "https://geojson.org/geojson-ld/geojson-context.jsonld",
        {
            "@version": "1.1",
            "wx": "https://api.weather.gov/ontology#",
            "s": "https://schema.org/",
            "geo": "http://www.opengis.net/ont/geosparql#",
            "unit": "http://codes.wmo.int/common/unit/",
            "@vocab": "https://api.weather.gov/ontology#",
            "geometry": {
                "@id": "s:GeoCoordinates",
                "@type": "geo:wktLiteral"
            },
            "city": "s:addressLocality",
            "state": "s:addressRegion",
            "distance": {
                "@id": "s:Distance",
                "@type": "s:QuantitativeValue"
            },
            "bearing": {
                "@type": "s:QuantitativeValue"
            },
            "value": {
                "@id": "s:value"
            },
            "unitCode": {
                "@id": "s:unitCode",
                "@type": "@id"
            },
            "forecastOffice": {
                "@type": "@id"
            },
            "forecastGridData": {
                "@type": "@id"
            },
            "publicZone": {
                "@type": "@id"
            },
            "county": {
                "@type": "@id"
            }
        }
    ],
    "id": "https://api.weather.gov/points/39.7456,-97.0892",
    "type": "Feature",
    "geometry": {
        "type": "Point",
        "coordinates": [
            -97.089200000000005,
            39.745600000000003
        ]
    },
    "properties": {
        "@id": "https://api.weather.gov/points/39.7456,-97.0892",
        "@type": "wx:Point",
        "cwa": "TOP",
        "forecastOffice": "https://api.weather.gov/offices/TOP",
        "gridId": "TOP",
        "gridX": 31,
        "gridY": 80,
        "forecast": "https://api.weather.gov/gridpoints/TOP/31,80/forecast",
        "forecastHourly": "https://api.weather.gov/gridpoints/TOP/31,80/forecast/hourly",
        "forecastGridData": "https://api.weather.gov/gridpoints/TOP/31,80",
        "observationStations": "https://api.weather.gov/gridpoints/TOP/31,80/stations",
        "relativeLocation": {
            "type": "Feature",
            "geometry": {
                "type": "Point",
                "coordinates": [
                    -97.086661000000007,
                    39.679375999999998
                ]
            },
            "properties": {
                "city": "Linn",
                "state": "KS",
                "distance": {
                    "unitCode": "wmoUnit:m",
                    "value": 7366.9851976443997
                },
                "bearing": {
                    "unitCode": "wmoUnit:degree_(angle)",
                    "value": 358
                }
            }
        },
        "forecastZone": "https://api.weather.gov/zones/forecast/KSZ009",
        "county": "https://api.weather.gov/zones/county/KSC201",
        "fireWeatherZone": "https://api.weather.gov/zones/fire/KSZ009",
        "timeZone": "America/Chicago",
        "radarStation": "KTWX"
    }
}

json['properties']['forecast'] or forecastHourly for the forecast URL.

https://api.weather.gov/gridpoints/TOP/31,80/forecast

{
    "@context": [
        "https://geojson.org/geojson-ld/geojson-context.jsonld",
        {
            "@version": "1.1",
            "wx": "https://api.weather.gov/ontology#",
            "geo": "http://www.opengis.net/ont/geosparql#",
            "unit": "http://codes.wmo.int/common/unit/",
            "@vocab": "https://api.weather.gov/ontology#"
        }
    ],
    "type": "Feature",
    "geometry": {
        "type": "Polygon",
        "coordinates": [
            [
                [
                    -97.1089731,
                    39.766826299999998
                ],
                [
                    -97.108526900000001,
                    39.744778799999999
                ],
                [
                    -97.079846700000004,
                    39.745119500000001
                ],
                [
                    -97.08028680000001,
                    39.767167000000001
                ],
                [
                    -97.1089731,
                    39.766826299999998
                ]
            ]
        ]
    },
    "properties": {
        "updated": "2022-02-07T23:11:57+00:00",
        "units": "us",
        "forecastGenerator": "BaselineForecastGenerator",
        "generatedAt": "2022-02-08T01:32:06+00:00",
        "updateTime": "2022-02-07T23:11:57+00:00",
        "validTimes": "2022-02-07T17:00:00+00:00/P7DT8H",
        "elevation": {
            "unitCode": "wmoUnit:m",
            "value": 441.95999999999998
        },
        "periods": [
            {
                "number": 1,
                "name": "Tonight",
                "startTime": "2022-02-07T19:00:00-06:00",
                "endTime": "2022-02-08T06:00:00-06:00",
                "isDaytime": false,
                "temperature": 31,
                "temperatureUnit": "F",
                "temperatureTrend": null,
                "windSpeed": "5 to 10 mph",
                "windDirection": "SW",
                "icon": "https://api.weather.gov/icons/land/night/few?size=medium",
                "shortForecast": "Mostly Clear",
                "detailedForecast": "Mostly clear, with a low around 31. Southwest wind 5 to 10 mph."
            },
            {
                "number": 2,
                "name": "Tuesday",
                "startTime": "2022-02-08T06:00:00-06:00",
                "endTime": "2022-02-08T18:00:00-06:00",
                "isDaytime": true,
                "temperature": 59,
                "temperatureUnit": "F",
                "temperatureTrend": null,
                "windSpeed": "10 to 20 mph",
                "windDirection": "W",
                "icon": "https://api.weather.gov/icons/land/day/few?size=medium",
                "shortForecast": "Sunny",
                "detailedForecast": "Sunny, with a high near 59. West wind 10 to 20 mph, with gusts as high as 30 mph."
            },
            {
                "number": 3,
                "name": "Tuesday Night",
                "startTime": "2022-02-08T18:00:00-06:00",
                "endTime": "2022-02-09T06:00:00-06:00",
                "isDaytime": false,
                "temperature": 31,
                "temperatureUnit": "F",
                "temperatureTrend": null,
                "windSpeed": "10 mph",
                "windDirection": "NW",
                "icon": "https://api.weather.gov/icons/land/night/few?size=medium",
                "shortForecast": "Mostly Clear",
                "detailedForecast": "Mostly clear, with a low around 31. Northwest wind around 10 mph."
            },
            {
                "number": 4,
                "name": "Wednesday",
                "startTime": "2022-02-09T06:00:00-06:00",
                "endTime": "2022-02-09T18:00:00-06:00",
                "isDaytime": true,
                "temperature": 54,
                "temperatureUnit": "F",
                "temperatureTrend": null,
                "windSpeed": "10 to 15 mph",
                "windDirection": "NW",
                "icon": "https://api.weather.gov/icons/land/day/sct?size=medium",
                "shortForecast": "Mostly Sunny",
                "detailedForecast": "Mostly sunny, with a high near 54. Northwest wind 10 to 15 mph, with gusts as high as 25 mph."
            },
            {
                "number": 5,
                "name": "Wednesday Night",
                "startTime": "2022-02-09T18:00:00-06:00",
                "endTime": "2022-02-10T06:00:00-06:00",
                "isDaytime": false,
                "temperature": 26,
                "temperatureUnit": "F",
                "temperatureTrend": null,
                "windSpeed": "10 mph",
                "windDirection": "N",
                "icon": "https://api.weather.gov/icons/land/night/sct?size=medium",
                "shortForecast": "Partly Cloudy",
                "detailedForecast": "Partly cloudy, with a low around 26. North wind around 10 mph."
            },
            {
                "number": 6,
                "name": "Thursday",
                "startTime": "2022-02-10T06:00:00-06:00",
                "endTime": "2022-02-10T18:00:00-06:00",
                "isDaytime": true,
                "temperature": 49,
                "temperatureUnit": "F",
                "temperatureTrend": null,
                "windSpeed": "10 to 15 mph",
                "windDirection": "NW",
                "icon": "https://api.weather.gov/icons/land/day/few?size=medium",
                "shortForecast": "Sunny",
                "detailedForecast": "Sunny, with a high near 49. Northwest wind 10 to 15 mph."
            },
            {
                "number": 7,
                "name": "Thursday Night",
                "startTime": "2022-02-10T18:00:00-06:00",
                "endTime": "2022-02-11T06:00:00-06:00",
                "isDaytime": false,
                "temperature": 36,
                "temperatureUnit": "F",
                "temperatureTrend": null,
                "windSpeed": "10 to 15 mph",
                "windDirection": "SW",
                "icon": "https://api.weather.gov/icons/land/night/sct?size=medium",
                "shortForecast": "Partly Cloudy",
                "detailedForecast": "Partly cloudy, with a low around 36. Southwest wind 10 to 15 mph, with gusts as high as 25 mph."
            },
            {
                "number": 8,
                "name": "Friday",
                "startTime": "2022-02-11T06:00:00-06:00",
                "endTime": "2022-02-11T18:00:00-06:00",
                "isDaytime": true,
                "temperature": 58,
                "temperatureUnit": "F",
                "temperatureTrend": null,
                "windSpeed": "15 to 20 mph",
                "windDirection": "NW",
                "icon": "https://api.weather.gov/icons/land/day/sct?size=medium",
                "shortForecast": "Mostly Sunny",
                "detailedForecast": "Mostly sunny, with a high near 58. Northwest wind 15 to 20 mph, with gusts as high as 25 mph."
            },
            {
                "number": 9,
                "name": "Friday Night",
                "startTime": "2022-02-11T18:00:00-06:00",
                "endTime": "2022-02-12T06:00:00-06:00",
                "isDaytime": false,
                "temperature": 20,
                "temperatureUnit": "F",
                "temperatureTrend": null,
                "windSpeed": "15 to 20 mph",
                "windDirection": "N",
                "icon": "https://api.weather.gov/icons/land/night/sct?size=medium",
                "shortForecast": "Partly Cloudy",
                "detailedForecast": "Partly cloudy, with a low around 20. North wind 15 to 20 mph, with gusts as high as 25 mph."
            },
            {
                "number": 10,
                "name": "Saturday",
                "startTime": "2022-02-12T06:00:00-06:00",
                "endTime": "2022-02-12T18:00:00-06:00",
                "isDaytime": true,
                "temperature": 37,
                "temperatureUnit": "F",
                "temperatureTrend": null,
                "windSpeed": "10 to 15 mph",
                "windDirection": "N",
                "icon": "https://api.weather.gov/icons/land/day/few?size=medium",
                "shortForecast": "Sunny",
                "detailedForecast": "Sunny, with a high near 37."
            },
            {
                "number": 11,
                "name": "Saturday Night",
                "startTime": "2022-02-12T18:00:00-06:00",
                "endTime": "2022-02-13T06:00:00-06:00",
                "isDaytime": false,
                "temperature": 21,
                "temperatureUnit": "F",
                "temperatureTrend": null,
                "windSpeed": "5 to 10 mph",
                "windDirection": "SW",
                "icon": "https://api.weather.gov/icons/land/night/few?size=medium",
                "shortForecast": "Mostly Clear",
                "detailedForecast": "Mostly clear, with a low around 21."
            },
            {
                "number": 12,
                "name": "Sunday",
                "startTime": "2022-02-13T06:00:00-06:00",
                "endTime": "2022-02-13T18:00:00-06:00",
                "isDaytime": true,
                "temperature": 52,
                "temperatureUnit": "F",
                "temperatureTrend": null,
                "windSpeed": "10 to 15 mph",
                "windDirection": "W",
                "icon": "https://api.weather.gov/icons/land/day/skc?size=medium",
                "shortForecast": "Sunny",
                "detailedForecast": "Sunny, with a high near 52."
            },
            {
                "number": 13,
                "name": "Sunday Night",
                "startTime": "2022-02-13T18:00:00-06:00",
                "endTime": "2022-02-14T06:00:00-06:00",
                "isDaytime": false,
                "temperature": 26,
                "temperatureUnit": "F",
                "temperatureTrend": null,
                "windSpeed": "10 mph",
                "windDirection": "W",
                "icon": "https://api.weather.gov/icons/land/night/skc?size=medium",
                "shortForecast": "Clear",
                "detailedForecast": "Clear, with a low around 26."
            },
            {
                "number": 14,
                "name": "Monday",
                "startTime": "2022-02-14T06:00:00-06:00",
                "endTime": "2022-02-14T18:00:00-06:00",
                "isDaytime": true,
                "temperature": 58,
                "temperatureUnit": "F",
                "temperatureTrend": null,
                "windSpeed": "10 to 15 mph",
                "windDirection": "S",
                "icon": "https://api.weather.gov/icons/land/day/few?size=medium",
                "shortForecast": "Sunny",
                "detailedForecast": "Sunny, with a high near 58."
            }
        ]
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant