Weather API Developer's Guide

NWS Weather Alerts Example

This section provides an example of a query for NWS weather warnings and watches for a specific location.

Note: The code examples use the placeholder text {YOUR_APP_CODE} and {YOUR_APP_ID} to indicate places where you should substitute your own unique app_id and app_code values. For more information about these authentication credentials, see Acquiring Credentials.

User Story

The user wants to obtain all active weather alerts for Lufkin, Texas.

Request Summary

Resource: report – note that resource representation is specified via extensions .xml or .json
Parameters: product – indicates what kind of report the query requests; in this example, the query uses the parameter value nws_alerts to request any active weather alerts.
  name – indicates the name of the city for which the query requests severe weather alerts.

Request

The code block below demonstrates the complete request, specifying that the response data are to be delivered in JSON.


https://weather.cit.api.here.com/weather/1.0/report.json
?app_id={YOUR_APP_ID}
&app_code={YOUR_APP_CODE}
&product=nws_alerts
&name=Lufkin,TX

Here is the same request indicating that the response data are to be delivered in XML.


https://weather.cit.api.here.com/weather/1.0/report.xml
?app_id={YOUR_APP_ID}
&app_code={YOUR_APP_CODE}
&product=nws_alerts
&name=Lufkin,TX

Response

The response to the request contains:

  • Active weather warnings

The example response in JSON format is as follows:


{
  "nwsAlerts": {
  "warning": [
    {
    "type": "6",
    "description": "FLOOD STATEMENT",
    "severity": 11,
    "message": "959 AM CDT MON MAY 19 2014 THE FLOOD WARNING CONTINUES FOR THE ANGELINA RIVER NEAR LUFKIN TEXAS. UNTIL FURTHER NOTICE...OR UNTIL THE WARNING IS CANCELLED. AT 715 AM MONDAY THE STAGE WAS 11.5 FEET. MINOR FLOODING IS OCCURRING AND MINOR FLOODING IS FORECAST. FLOOD STAGE IS 10 FEET. FORECAST...EXPECT LITTLE CHANGE THROUGH TUESDAY MORNING. IMPACT...MINOR LOWLAND FLOODING.",
    "county": [
      {
      "value": "TXC005",
      "country": "US",
      "countryName": "United States",
      "state": "TX",
      "stateName": "Texas",
      "name": "Angelina",
      "latitude": 31.28145,
      "longitude": -94.56949
      },
      {
      "value": "TXC073",
      "country": "US",
      "countryName": "United States",
      "state": "TX",
      "stateName": "Texas",
      "name": "Cherokee",
      "latitude": 31.79083,
      "longitude": -95.16899
      },
      {
      "value": "TXC347",
      "country": "US",
      "countryName": "United States",
      "state": "TX",
      "stateName": "Texas",
      "name": "Nacogdoches",
      "latitude": 31.53719,
      "longitude": -94.64497
      }
    ],
    "location": [],
    "name": "Lamont",
    "validFromTimeLocal": "2014-05-19T09:59:00.00-05:00",
    "validUntilTimeLocal": "2014-05-20T09:59:00.00-05:00",
    "country": "United States",
    "state": "Texas",
    "latitude": 31.54,
    "longitude": -94.79
    }
  ],
  "watch": [
    {
    "type": "12",
    "description": "NON PRECIPITATION WARNING, WATCH, OR STATEMENT",
    "severity": 67,
    "message": "URGENT - WEATHER MESSAGE ...LAKE WIND ADVISORY IN EFFECT FROM 9 AM TO 4 PM CDT TODAY FOR PARTS OF EAST AND NORTHEAST TEXAS AS WELL AS SOUTHEAST OKLAHOMA... .A TIGHT PRESSURE GRADIENT BETWEEN SURFACE HIGH PRESSURE OFF TO THE EAST AND SURFACE LOW PRESSURE OVER THE PLAINS WILL RESULT STRONG AND GUSTY SOUTHERLY WINDS. SOUTH WINDS OF 15 TO 20 MPH WITH HIGHER GUSTS TO NEAR 30 MPH ARE EXPECTED THROUGHOUT THE DAY. MCCURTAIN-RED RIVER-FRANKLIN-TITUS-CAMP-MORRIS-WOOD-UPSHUR-SMITH- GREGG-CHEROKEE-RUSK- INCLUDING THE CITIES OF...IDABEL...CLARKSVILLE...MT VERNON... MT PLEASANT...PITTSBURG...DAINGERFIELD...QUITMAN...GILMER... TYLER...LONGVIEW...RUSK...HENDERSON 313 AM CDT TUE MAY 20 2014 ...LAKE WIND ADVISORY IN EFFECT FROM 9 AM THIS MORNING TO 4 PM CDT THIS AFTERNOON... THE NATIONAL WEATHER SERVICE IN SHREVEPORT HAS ISSUED A LAKE WIND ADVISORY...WHICH IS IN EFFECT FROM 9 AM THIS MORNING TO 4 PM CDT THIS AFTERNOON. EVENT...SOUTH WINDS 15 TO 20 MPH WITH GUSTS TO NEAR 30 MPH. TIMING...FROM 9 AM CDT TO 4 PM CDT TODAY. IMPACT...HAZARDOUS BOATING CONDITIONS CAN BE EXPECTED DUE TO A ROUGH CHOP ON AREA LAKES AND OPEN WATERS. PRECAUTIONARY/PREPAREDNESS ACTIONS... A LAKE WIND ADVISORY INDICATES THAT WINDS WILL CAUSE ROUGH CHOP ON AREA LAKES. SMALL BOATS WILL BE ESPECIALLY PRONE TO CAPSIZING.",
    "zone": [
      {
      "value": "OKZ077",
      "country": "US",
      "countryName": "United States",
      "state": "OK",
      "stateName": "Oklahoma",
      "name": "McCurtain",
      "latitude": 34.06559,
      "longitude": -94.80965
      },
      {
      "value": "TXZ096",
      "country": "US",
      "countryName": "United States",
      "state": "TX",
      "stateName": "Texas",
      "name": "Red River",
      "latitude": 33.64744,
      "longitude": -95.02075
      },
      {
      "value": "TXZ108",
      "country": "US",
      "countryName": "United States",
      "state": "TX",
      "stateName": "Texas",
      "name": "Franklin",
      "latitude": 33.1802,
      "longitude": -95.20966
      },
      {
      "value": "TXZ109",
      "country": "US",
      "countryName": "United States",
      "state": "TX",
      "stateName": "Texas",
      "name": "Titus",
      "latitude": 33.19375,
      "longitude": -94.97083
      },
      {
      "value": "TXZ110",
      "country": "US",
      "countryName": "United States",
      "state": "TX",
      "stateName": "Texas",
      "name": "Camp",
      "latitude": 32.99626,
      "longitude": -94.93977
      },
      {
      "value": "TXZ111",
      "country": "US",
      "countryName": "United States",
      "state": "TX",
      "stateName": "Texas",
      "name": "Morris",
      "latitude": 33.13214,
      "longitude": -94.73597
      },
      {
      "value": "TXZ124",
      "country": "US",
      "countryName": "United States",
      "state": "TX",
      "stateName": "Texas",
      "name": "Wood",
      "latitude": 32.78013,
      "longitude": -95.40378
      },
      {
      "value": "TXZ125",
      "country": "US",
      "countryName": "United States",
      "state": "TX",
      "stateName": "Texas",
      "name": "Upshur",
      "latitude": 32.72038,
      "longitude": -94.9246
      },
      {
      "value": "TXZ136",
      "country": "US",
      "countryName": "United States",
      "state": "TX",
      "stateName": "Texas",
      "name": "Smith",
      "latitude": 32.41533,
      "longitude": -95.28996
      },
      {
      "value": "TXZ137",
      "country": "US",
      "countryName": "United States",
      "state": "TX",
      "stateName": "Texas",
      "name": "Gregg",
      "latitude": 32.51278,
      "longitude": -94.78178
      },
      {
      "value": "TXZ149",
      "country": "US",
      "countryName": "United States",
      "state": "TX",
      "stateName": "Texas",
      "name": "Cherokee",
      "latitude": 31.79083,
      "longitude": -95.16899
      },
      {
      "value": "TXZ150",
      "country": "US",
      "countryName": "United States",
      "state": "TX",
      "stateName": "Texas",
      "name": "Rusk",
      "latitude": 32.12721,
      "longitude": -94.72372
      }
    ],
    "location": [],
    "name": "Pine Hill [Cherokee County]",
    "validFromTimeLocal": "2014-05-20T03:13:00.00-05:00",
    "validUntilTimeLocal": "2014-05-20T16:00:00.00-05:00",
    "country": "United States",
    "state": "Texas",
    "latitude": 32.88,
    "longitude": -95
    }
  ]
  },
  "feedCreation": "2014-05-20T09:24:58.230",
  "metric": true
}

The example response in XML format is as follows:


<WeatherReport>
  <nwsAlerts>
    <warning longitude="-94.79" latitude="31.54" state="Texas" country="United States" validUntilTimeLocal="2014-05-20T09:59:00.000-05:00" validFromTimeLocal="2014-05-19T09:59:00.000-05:00"
      name="Lamont"
    >
      <type>6</type>
      <description>FLOOD STATEMENT</description>
      <severity>11</severity>
      <message>959 AM CDT MON MAY 19 2014 THE FLOOD WARNING CONTINUES FOR THE ANGELINA RIVER NEAR LUFKIN TEXAS. UNTIL FURTHER NOTICE...OR UNTIL THE WARNING IS CANCELLED. AT 715 AM
        MONDAY THE STAGE WAS 11.5 FEET. MINOR FLOODING IS OCCURRING AND MINOR FLOODING IS FORECAST. FLOOD STAGE IS 10 FEET. FORECAST...EXPECT LITTLE CHANGE THROUGH TUESDAY MORNING.
        IMPACT...MINOR LOWLAND FLOODING.</message>
      <county longitude="-94.56949" latitude="31.28145" name="Angelina" stateName="Texas" state="TX" countryName="United States" country="US">TXC005</county>
      <county longitude="-95.16899" latitude="31.79083" name="Cherokee" stateName="Texas" state="TX" countryName="United States" country="US">TXC073</county>
      <county longitude="-94.64497" latitude="31.53719" name="Nacogdoches" stateName="Texas" state="TX" countryName="United States" country="US">TXC347</county>
    </warning>
    <watch longitude="-95.00" latitude="32.88" state="Texas" country="United States" validUntilTimeLocal="2014-05-20T16:00:00.000-05:00" validFromTimeLocal="2014-05-20T03:13:00.000-05:00"
      name="Pine Hill [Cherokee County]"
    >
      <type>12</type>
      <description>NON PRECIPITATION WARNING, WATCH, OR STATEMENT</description>
      <severity>67</severity>
      <message>URGENT - WEATHER MESSAGE ...LAKE WIND ADVISORY IN EFFECT FROM 9 AM TO 4 PM CDT TODAY FOR PARTS OF EAST AND NORTHEAST TEXAS AS WELL AS SOUTHEAST OKLAHOMA... .A TIGHT
        PRESSURE GRADIENT BETWEEN SURFACE HIGH PRESSURE OFF TO THE EAST AND SURFACE LOW PRESSURE OVER THE PLAINS WILL RESULT STRONG AND GUSTY SOUTHERLY WINDS. SOUTH WINDS OF 15 TO 20
        MPH WITH HIGHER GUSTS TO NEAR 30 MPH ARE EXPECTED THROUGHOUT THE DAY. MCCURTAIN-RED RIVER-FRANKLIN-TITUS-CAMP-MORRIS-WOOD-UPSHUR-SMITH- GREGG-CHEROKEE-RUSK- INCLUDING THE
        CITIES OF...IDABEL...CLARKSVILLE...MT VERNON... MT PLEASANT...PITTSBURG...DAINGERFIELD...QUITMAN...GILMER... TYLER...LONGVIEW...RUSK...HENDERSON 313 AM CDT TUE MAY 20 2014
        ...LAKE WIND ADVISORY IN EFFECT FROM 9 AM THIS MORNING TO 4 PM CDT THIS AFTERNOON... THE NATIONAL WEATHER SERVICE IN SHREVEPORT HAS ISSUED A LAKE WIND ADVISORY...WHICH IS IN
        EFFECT FROM 9 AM THIS MORNING TO 4 PM CDT THIS AFTERNOON. EVENT...SOUTH WINDS 15 TO 20 MPH WITH GUSTS TO NEAR 30 MPH. TIMING...FROM 9 AM CDT TO 4 PM CDT TODAY.
        IMPACT...HAZARDOUS BOATING CONDITIONS CAN BE EXPECTED DUE TO A ROUGH CHOP ON AREA LAKES AND OPEN WATERS. PRECAUTIONARY/PREPAREDNESS ACTIONS... A LAKE WIND ADVISORY INDICATES
        THAT WINDS WILL CAUSE ROUGH CHOP ON AREA LAKES. SMALL BOATS WILL BE ESPECIALLY PRONE TO CAPSIZING.</message>
      <zone longitude="-94.80965" latitude="34.06559" name="McCurtain" stateName="Oklahoma" state="OK" countryName="United States" country="US">OKZ077</zone>
      <zone longitude="-95.02075" latitude="33.64744" name="Red River" stateName="Texas" state="TX" countryName="United States" country="US">TXZ096</zone>
      <zone longitude="-95.20966" latitude="33.1802" name="Franklin" stateName="Texas" state="TX" countryName="United States" country="US">TXZ108</zone>
      <zone longitude="-94.97083" latitude="33.19375" name="Titus" stateName="Texas" state="TX" countryName="United States" country="US">TXZ109</zone>
      <zone longitude="-94.93977" latitude="32.99626" name="Camp" stateName="Texas" state="TX" countryName="United States" country="US">TXZ110</zone>
      <zone longitude="-94.73597" latitude="33.13214" name="Morris" stateName="Texas" state="TX" countryName="United States" country="US">TXZ111</zone>
      <zone longitude="-95.40378" latitude="32.78013" name="Wood" stateName="Texas" state="TX" countryName="United States" country="US">TXZ124</zone>
      <zone longitude="-94.9246" latitude="32.72038" name="Upshur" stateName="Texas" state="TX" countryName="United States" country="US">TXZ125</zone>
      <zone longitude="-95.28996" latitude="32.41533" name="Smith" stateName="Texas" state="TX" countryName="United States" country="US">TXZ136</zone>
      <zone longitude="-94.78178" latitude="32.51278" name="Gregg" stateName="Texas" state="TX" countryName="United States" country="US">TXZ137</zone>
      <zone longitude="-95.16899" latitude="31.79083" name="Cherokee" stateName="Texas" state="TX" countryName="United States" country="US">TXZ149</zone>
      <zone longitude="-94.72372" latitude="32.12721" name="Rusk" stateName="Texas" state="TX" countryName="United States" country="US">TXZ150</zone>
    </watch>
  </nwsAlerts>
  <feedCreation>2014-05-20T09:23:16.977Z</feedCreation>
  <metric>true</metric>
</WeatherReport>

For more details about responses to this type of request, see Report Response.

You cannot use this account to purchase a commercial plan on Developer Portal, as it is already associated to plans with different payment methods.

To purchase a commercial plan on Developer Portal, please register for or sign in with a different HERE Account.

Something took longer than expected.

The project should be available soon under your projects page.

Sorry, our services are not available in this region.

Something seems to have gone wrong. Please try again later.

We've detected that your account is set to Australian Dollars (AUD).
Unfortunately, we do not offer checkouts in AUD anymore.
You can continue using your current plan as normal, but to subscribe to one of our new plans,
please register for a new HERE account or contact us for billing questions on selfservesupport@here.com.