1

为什么不同格式xml格式返回OpenWeatherMap api的温度值不一样: http ://api.openweathermap.org/data/2.5/forecast/daily?q=shanghai&units=metric&mode=xml&cnt=3

            <weatherdata>
              <location>
                <name>Shanghai</name>
                <type/>
                <country>CN</country>
                <timezone/>
                <location altitude="0" latitude="31.222219" longitude="121.458061" geobase="geonames" geobaseid="0"/>
              </location>
              <credit/>
              <meta>
                <lastupdate/>
                <calctime>0.0165</calctime>
                <nextupdate/>
              </meta>
              <sun rise="2014-03-26T21:48:52" set="2014-03-27T10:10:08"/>
              <forecast>
                <time day="2014-03-27">
                  <symbol number="800" name="sky is clear" var="01d"/>
                  <precipitation/>
                  <windDirection deg="117" code="ESE" name="East-southeast"/>
                  <windSpeed mps="4" name="Gentle Breeze"/>
                  <temperature day="21.89" min="12.59" max="25.08" night="14.14" eve="22.43" morn="12.59"/>
                  <pressure unit="hPa" value="1031.37"/>
                  <humidity value="72" unit="%"/>
                  <clouds value="sky is clear" all="0" unit="%"/>
                </time>
                <time day="2014-03-28">
                  <symbol number="501" name="moderate rain" var="10d"/>
                  <precipitation value="5" type="rain"/>
                  <windDirection deg="143" code="SE" name="SouthEast"/>
                  <windSpeed mps="8.7" name="Fresh Breeze"/>
                  <temperature day="18.32" min="15.27" max="18.51" night="17.4" eve="18.51" morn="15.27"/>
                  <pressure unit="hPa" value="1026"/>
                  <humidity value="96" unit="%"/>
                  <clouds value="overcast clouds" all="92" unit="%"/>
                </time>
                <time day="2014-03-29">
                  <symbol number="502" name="heavy intensity rain" var="10d"/>
                  <precipitation value="24" type="rain"/>
                  <windDirection deg="260" code="W" name="West"/>
                  <windSpeed mps="5.94" name="Moderate breeze"/>
                  <temperature day="19.68" min="13.92" max="19.68" night="13.92" eve="17.83" morn="18.49"/>
                  <pressure unit="hPa" value="1015.91"/>
                  <humidity value="99" unit="%"/>
                  <clouds value="overcast clouds" all="92" unit="%"/>
                </time>
              </forecast>
            </weatherdata>

json格式: http ://api.openweathermap.org/data/2.5/forecast/daily?q=shanghai&units=metric&mode=json&cnt=3

            {
              "cod": "200",
              "message": 0.019,
              "city": {
                "id": 1796236,
                "name": "Shanghai",
                "coord": {
                  "lon": 121.458061,
                  "lat": 31.222219
                },
                "country": "CN",
                "population": 0,
                "sys": {
                  "population": 0
                }
              },
              "cnt": 3,
              "list": [
                {
                  "dt": 1395892800,
                  "temp": {
                    "day": 21.82,
                    "min": 12.51,
                    "max": 25.01,
                    "night": 14.09,
                    "eve": 22.37,
                    "morn": 12.51
                  },
                  "pressure": 1031.37,
                  "humidity": 72,
                  "weather": [
                    {
                      "id": 800,
                      "main": "Clear",
                      "description": "sky is clear",
                      "icon": "01d"
                    }
                  ],
                  "speed": 4,
                  "deg": 117,
                  "clouds": 0
                },
                {
                  "dt": 1395979200,
                  "temp": {
                    "day": 18.28,
                    "min": 15.22,
                    "max": 18.47,
                    "night": 17.38,
                    "eve": 18.47,
                    "morn": 15.22
                  },
                  "pressure": 1026,
                  "humidity": 96,
                  "weather": [
                    {
                      "id": 501,
                      "main": "Rain",
                      "description": "moderate rain",
                      "icon": "10d"
                    }
                  ],
                  "speed": 8.7,
                  "deg": 143,
                  "clouds": 92,
                  "rain": 5
                },
                {
                  "dt": 1396065600,
                  "temp": {
                    "day": 19.67,
                    "min": 13.92,
                    "max": 19.67,
                    "night": 13.92,
                    "eve": 17.83,
                    "morn": 18.48
                  },
                  "pressure": 1015.91,
                  "humidity": 99,
                  "weather": [
                    {
                      "id": 502,
                      "main": "Rain",
                      "description": "heavy intensity rain",
                      "icon": "10d"
                    }
                  ],
                  "speed": 5.94,
                  "deg": 260,
                  "clouds": 92,
                  "rain": 24
                }
              ]
            }

温度:json "temp":{"day":21.82,"min":12.51,"max":25.01,"night":14.09,"eve":22.37,"morn":12.51},"pressure": 1031.37,"湿度":72 xml 压力一样,为什么温度不一样?

4

0 回答 0