【问题标题】:Where can I find a JSON weather api for an iphone app?我在哪里可以找到适用于 iphone 应用程序的 JSON 天气 API?
【发布时间】:2011-03-26 18:34:06
【问题描述】:

我发现的大多数使用 xml,而 id 则只使用 JSON 目标 c 源代码。

有什么建议吗?

我看过这个:

https://stackoverflow.com/questions/507441/best-weather-apis

【问题讨论】:

  • worldweatheronline.com/free-weather-feed.aspx 使用 JSON 并在您上面链接到的相关问题中提到...那么您未包含的 API 的附加标准是什么?
  • 不太好,我住在旧金山,一两英里外的天气可能会大不相同,而且这个 api 只有非常少的数据点。
  • Best Weather APIs?的可能重复
  • @vikingosegundo 因为 JSON 在很多方面都更好,更不用说 iOS 现在原生支持 JSON
  • @PeteHerbertPenito iOS 本身也支持 xml。对于应用程序而言,格式正确的 xml 或格式正确的 JSON 并不重要。

标签: iphone json api weather-api


【解决方案1】:

Weather Underground 有一个返回 JSON 和 XML 的 API。价格公道,外加每天 500 次免费开发者电话。 Weather Underground 在 NOAA 官方站之外有许多当地气象站,在 SF 地区是一个不错的数字。

http://www.wunderground.com/weather/api/d/documentation.html

【讨论】:

    【解决方案2】:

    注意:此 API 现在已被 Yahoo 弃用,将无法使用


    我在搞砸了一段时间后发现了一个未记录的 Yahoo Weather API。这是一个示例链接:

    http://weather.yahooapis.com/forecastjson?w=12844782&u=c

    w 后面的值为 WOEID,u 为单位。我确信有更多选项可用于配置 URL。

    它是这样的:

    {
       "units":{
          "temperature":"C",
          "speed":"km\/h",
          "distance":"km",
          "pressure":"mb"
       },
       "location":{
          "location_id":"ITXX0024",
          "city":"Como",
          "state_abbreviation":"*",
          "country_abbreviation":"IT",
          "elevation":935,
          "latitude":45.81000000000000,
          "longitude":9.08000000000000
       },
       "wind":{
          "speed":5.00000000000000,
          "direction":"VAR"
       },
       "atmosphere":{
          "humidity":"40",
          "visibility":9.99000000000000,
          "pressure":982.00000000000000,
          "rising":"steady"
       },
       "url":"http:\/\/weather.yahoo.com\/forecast\/ITXX0024.html",
       "logo":"http:\/\/l.yimg.com\/a\/i\/us\/nt\/ma\/ma_nws-we_1.gif",
       "astronomy":{
          "sunrise":"08:01",
          "sunset":"16:42"
       },
       "condition":{
          "text":"Fair",
          "code":"34",
          "image":"http:\/\/l.yimg.com\/a\/i\/us\/we\/52\/34.gif",
          "temperature":9.00000000000000
       },
       "forecast":[
          {
             "day":"Today",
             "condition":"Mostly Clear",
             "high_temperature":7.00000000000000,
             "low_temperature":2.00000000000000
          },
          {
             "day":"Tomorrow",
             "condition":"Partly Cloudy",
             "high_temperature":8.00000000000000,
             "low_temperature":2.00000000000000
          },
          {
             "day":"Friday",
             "condition":"Sunny",
             "high_temperature":8.00000000000000,
             "low_temperature":3.00000000000000
          },
          {
             "day":"Saturday",
             "condition":"Mostly Sunny",
             "high_temperature":7.00000000000000,
             "low_temperature":1.00000000000000
          },
          {
             "day":"Sunday",
             "condition":"Sunny",
             "high_temperature":8.00000000000000,
             "low_temperature":1.00000000000000
          }
       ]
    }
    

    【讨论】:

    • 确实如此,而且这已经在我的回答顶部提到了一段时间。
    【解决方案3】:

    试用我们最近发布的新 Aeris Weather API。极其灵活,并提供多种数据选项,未来还会有更多选项。我们还提供了一个免费的开发者帐户,您每天最多可以点击 750 次。

    http://www.hamweather.com/products/aeris-api/
    http://www.hamweather.com/support/documentation/aeris/

    【讨论】:

    • 另外,由于您正在开发一个 iPhone 应用程序,他们有一个 iOS 天气框架,旨在为您提供一些非常简单的天气实现。
    猜你喜欢
    • 2011-05-16
    • 2011-07-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-09-21
    • 1970-01-01
    • 2014-04-28
    • 2017-02-04
    相关资源
    最近更新 更多