CICCIOSGAMINO / openweather-apis

Simple APIs for OpenWeatherMap.org basic services
GNU General Public License v3.0
44 stars 27 forks source link

got different responses processing getWeatherForecastForDays with coordinates and name #12

Closed d-koppenhagen closed 8 years ago

d-koppenhagen commented 8 years ago

Hey, I want to get some weather data from a location and I tried this using weather.setCity('Berlin'); and with weather.setCoordinate(50.0467656, 20.0048731); (example coordinates). After I called the forecast function like that:

weather.getWeatherForecastForDays(3, function(err, obj){
   console.log(obj);
});

I got different responses (different structure of data) for both cases. Why isn't it the same structure? It seems that the getWeatherForecastForDays-function doesn't send back a real forecast using coordinates because there is no list-Array in the response (have a look at the responses):

Example Forecast-Response using name

{ "city" : { "coord" : { "lat" : 52.25,
          "lon" : 14.41667
        },
      "country" : "DE",
      "id" : 2867763,
      "name" : "Mullrose",
      "population" : 0
    },
  "cnt" : 5,
  "cod" : "200",
  "list" : [ { "clouds" : 92,
        "deg" : 259,
        "dt" : 1451127600,
        "humidity" : 75,
        "pressure" : 1028.6900000000001,
        "speed" : 9.8200000000000003,
        "temp" : { "day" : 15.279999999999999,
            "eve" : 14.24,
            "max" : 15.69,
            "min" : 11.44,
            "morn" : 15.279999999999999,
            "night" : 11.44
          },
        "weather" : [ { "description" : "leichter Regen",
              "icon" : "10d",
              "id" : 500,
              "main" : "Rain"
            } ]
      },
      { "clouds" : 0,
        "deg" : 117,
        "dt" : 1451386800,
        "humidity" : 90,
        "pressure" : 1036.6600000000001,
        "speed" : 4.9699999999999998,
        "temp" : { "day" : 8.9100000000000001,
            "eve" : 5.9199999999999999,
            "max" : 8.9100000000000001,
            "min" : 5.5899999999999999,
            "morn" : 5.5899999999999999,
            "night" : 5.9199999999999999
          },
        "weather" : [ { "description" : "klarer Himmel",
              "icon" : "01d",
              "id" : 800,
              "main" : "Clear"
            } ]
      },
      { "clouds" : 24,
        "deg" : 133,
        "dt" : 1451473200,
        "humidity" : 82,
        "pressure" : 1043.96,
        "speed" : 7.3099999999999996,
        "temp" : { "day" : 3.71,
            "eve" : 1.54,
            "max" : 3.71,
            "min" : -0.12,
            "morn" : 2.9300000000000002,
            "night" : -0.12
          },
        "weather" : [ { "description" : "ein paar Wolken",
              "icon" : "02d",
              "id" : 801,
              "main" : "Clouds"
            } ]
      }
    ],
  "message" : 0.0071000000000000004
}

Example Forecast-Response using coordinates

{ "base" : "cmc stations",
  "clouds" : { "all" : 92 },
  "cod" : 200,
  "coord" : { "lat" : 52.25,
      "lon" : 14.42
    },
  "dt" : 1451135194,
  "id" : 2867763,
  "main" : { "grnd_level" : 1028.6900000000001,
      "humidity" : 75,
      "pressure" : 1028.6900000000001,
      "sea_level" : 1035.71,
      "temp" : 13.24,
      "temp_max" : 13.24,
      "temp_min" : 13.24
    },
  "name" : "Mullrose",
  "sys" : { "country" : "DE",
      "message" : 0.0025999999999999999,
      "sunrise" : 1451113883,
      "sunset" : 1451141680
    },
  "weather" : [ { "description" : "wolkenbedeckt",
        "icon" : "04d",
        "id" : 804,
        "main" : "Clouds"
      } ],
  "wind" : { "deg" : 258.50200000000001,
      "speed" : 9.8200000000000003
    }
}
CICCIOSGAMINO commented 8 years ago

Depend from the Openweather service, look at the openweather site !