node-openweathermap icon indicating copy to clipboard operation
node-openweathermap copied to clipboard

How to get precipitation

Open M-Pixel opened this issue 9 years ago • 1 comments

When I do a request straight to their API in my browser, I can see "rain" in the results. Why doesn't this come through in the JSON returned by your wrapper?

http://api.openweathermap.org/data/2.5/forecast?q=Okemos,MI&mode=json

M-Pixel avatar Jul 15 '14 17:07 M-Pixel

Hi,

can you paste your code snippet?

when I execute

  var weather;

  weather = require('openweathermap');

  weather.forecast({
    q: 'Okemos,MI'
  }, function(json) {
    console.log(JSON.stringify(json, false, 2));
  });

I get the rain

{
  "cod": "200",
  "message": 0.4696,
  "city": {
    "id": "5004359",
    "name": "",
    "coord": {
      "lon": -84.43,
      "lat": 42.7155
    },
    "country": "",
    "population": 0
  },
  "cnt": 28,
  "list": [
    {
      "dt": 1405522800,
      "main": {
        "temp": 287.87,
        "temp_min": 287.87,
        "temp_max": 289.726,
        "pressure": 993.86,
        "sea_level": 1026.15,
        "grnd_level": 993.86,
        "humidity": 82,
        "temp_kf": -1.86
      },
      "weather": [
        {
          "id": 800,
          "main": "Clear",
          "description": "sky is clear",
          "icon": "02d",
          "iconUrl": "http://openweathermap.org/img/w/02d.png"
        }
      ],
      "clouds": {
        "all": 8
      },
      "wind": {
        "speed": 5.13,
        "deg": 306
      },
->    "rain": {
        "3h": 0
      },
      "sys": {
        "pod": "d"
      },
      "dt_txt": "2014-07-16 15:00:00"
    },
...

baslr avatar Jul 16 '14 15:07 baslr