我怎样才能获得最新的气候详情JSON?

时间:2013-10-29 11:16:30

标签: ios json maps weather

Hi iam计划创建一个应用程序,向普通用户提供最新的气候信息,因此如果气候有任何变化,他们就可以做好准备并避免灾难。

但我不知道从哪里得到这些JSON的所有细节? 请帮忙..

我试过这个但是没用“

http://blog.programmableweb.com/2012/01/11/12-json-weather-apis/

3 个答案:

答案 0 :(得分:1)

也许不是在这个问题上,但我会写几句话。实际上不一定是JSON。通过链接,您可以看到以XML格式提供数据的天气服务比JSON更多。您还可以使用简单的转换器simple converter 来使用XML。这是为了扩大您的搜索范围。

PS:在示例中,有一个代码可以从天气服务accuweather.com转换XML格式的答案(可能更改为您需要的另一个)。

答案 1 :(得分:0)

你应该看看OpenWeatherMap。您可以创建一个简单的GET请求,包括URI中的位置,例如:

http://api.openweathermap.org/data/2.5/weather?q=London,uk

返回:

{ "base" : "gdps stations",
  "clouds" : { "all" : 12 },
  "cod" : 200,
  "coord" : { "lat" : 51.506399999999999,
      "lon" : -0.12719
    },
  "dt" : 1383042292,
  "id" : 2633993,
  "main" : { "grnd_level" : 1012.4400000000001,
      "humidity" : 93,
      "pressure" : 1012.4400000000001,
      "sea_level" : 1021.04,
      "temp" : 281.64800000000002,
      "temp_max" : 281.64800000000002,
      "temp_min" : 281.64800000000002
    },
  "name" : "London",
  "rain" : { "3h" : 0 },
  "sys" : { "country" : "United Kingdom",
      "sunrise" : 1383029402,
      "sunset" : 1383064700
    },
  "weather" : [ { "description" : "few clouds",
        "icon" : "02d",
        "id" : 801,
        "main" : "Clouds"
      } ],
  "wind" : { "deg" : 260.00099999999998,
      "speed" : 4.5599999999999996
    }
}

这对你有用吗?

答案 2 :(得分:-1)

你可以使用accuweather api。它在天气预报中最准确 它为android提供了api;我们两个

http://api.accuweather.com/