Yahoo! YOLP 気象情報API とは
・指定した緯度経度の雨の強さを取得できるAPIです。
・現在時刻の降水強度実測値から、60分後までの降水強度予測値を取得できます。
YOLP(地図):気象情報API - Yahoo!デベロッパーネットワーク
降水強度とは
※降水強度は、気象レーダーで観測された降水の強さを時間雨量(mm/h)に換算した値で、実際の雨量とは異なります。
YOLP(地図):気象情報API - Yahoo!デベロッパーネットワーク
検索してみたけど、他に説明しているページは見つけられなかった。たぶん、降雨強度と同じと考えてよさそう。
降雨強度についてはわりと見つかる。
瞬間的な雨の強さを1時間あたりに換算した雨量を降雨強度といいます.単位はmm/h(ミリメートル毎時)です.1分間の雨量を1時間あたりに換算するのが基本です.
たとえば1分間に2.5mmの雨が降ったときは 2.5×60=150 (mm/h) となります.
雨量の定義
まず、降雨強度ですがこれは瞬間最大降雨量のことで、単位は○○mm/hで、1時間に換算した降雨量を示しているので、車で言うスピードメーターの値と一緒で、車の速度は、○○km/hで表示されます。
要するに、今の降り方で1時間続いた場合の雨量を示した値なのです。車の場合も同様で、今のスピードで1時間連続して走り続けた場合の距離を示した値なのです。
従いまして、「戸田市では、時間あたり50mm.の強さの雨を記録しました。」ですとか、「この1時間に50mm.の雨を記録しました。」と、よく報告されますが、これが瞬間最大の降雨強度を示しているわけです。
このことから、最大が50mm.の雨を記録した時間帯(1時間)でも、このときの「合計雨量は、15mm.」でした。という具合なのです。
降雨強度と降雨量の違い?
降雨量(降水量)については Wikipedia を参考に。
降水量が1時間 1 mm となる水の量とは、1 m² の面積に 1 mm 、つまり 100 cm × 100 cm × 0.1 cm = 1000 cm³ = 1 L なので、直立した人の上 ( 50 cm × 50 cm ) に 30分で 125 mL の水が降る量である。個人感覚、風の影響にもよるが、降水量1時間 1 mm 未満の雨であれば短い距離を傘なしで歩くことができる。1 mm を超えると一般に傘などの雨具が必要である。一時間 3 mm 以上で、舗装されていない道に水溜りが発生する。
地域によって異なるものの、1時間 20 - 40 mmで「大雨注意報」、40 - 60 mm で「大雨警報」が出される目安といえる。
降水量 - Wikipedia
パラメータの例
試しに、名古屋駅 (緯度=35.1707221, 経度=136.881487) と 津幡駅 (緯度=36.6577659, 経度=136.730442) の雨の強さを取得する。
1時間前から現在時刻までの降水強度実測値と、1時間後までの降水強度予測値を取得するように、パラメータを組み立ててみる。
http://weather.olp.yahooapis.jp/v1/place
?appid=<YOUR APPLICATION ID>
&past=1
&interval=10
&coordinates=136.647905,36.5787389 136.881487,35.1707221
&output=xml
- past=1 : 1時間前からの降水強度実測値を取得
- interval=10 : 降水強度の取得間隔を10分に指定
- coordinates : 名古屋駅と津幡駅の緯度経度を指定。経度,緯度の順番。緯度経度を複数指定する場合は半角スペースで区切る(%エンコードを忘れずに)。最大10点まで指定可能
- output=xml : レスポンスをXMLで取得する。JSON の場合は output=json を指定
レスポンスデータに含まれる降水強度の情報
降水強度の情報はこんな感じ。
<Weather>
<Type>forecast</Type>
<Date>201411190005</Date>
<Rainfall>1.85</Rainfall>
</Weather>
Type の値は、observation が実測値で、forecast が予測値。
Date の値は、年月日時分の12文字。
Rainfall の値は降水強度。
Rainfall の説明を引用。
降水強度です(単位:mm/h)。小数点第二位までの精度です。
※降水強度は、気象レーダーで観測された降水の強さを時間雨量(mm/h)に換算した値で、実際の雨量とは異なります。
YOLP(地図):気象情報API - Yahoo!デベロッパーネットワーク
output=xml の場合
リクエストURL。
http://weather.olp.yahooapis.jp/v1/place?appid=<YOUR APPLICATION ID>&past=1&interval=10&coordinates=136.730442,36.6577659%20136.881487,35.1707221&output=xml
実際のレスポンスデータの、タブ文字を空白2文字に変換したものを以下に貼っておく。
<?xml version="1.0" encoding="UTF-8"?>
<YDF xmlns="http://olp.yahooapis.jp/ydf/1.0" firstResultPosition="1" totalResultsAvailable="1" totalResultsReturned="1">
<ResultInfo>
<Count>2</Count>
<Total>2</Total>
<Start>1</Start>
<Status>200</Status>
<Latency>0.007308</Latency>
<Description></Description>
<Copyright>(C) Yahoo Japan Corporation.</Copyright>
</ResultInfo>
<Feature>
<Id>201411182255_136.73044_36.657766</Id>
<Name>地点(136.73044,36.657766)の2014年11月18日 22時55分から120分間の天気情報</Name>
<Geometry>
<Type>point</Type>
<Coordinates>136.73044,36.657766</Coordinates>
</Geometry>
<Property>
<WeatherAreaCode>5610</WeatherAreaCode>
<WeatherList>
<Weather>
<Type>observation</Type>
<Date>201411182255</Date>
<Rainfall>0.00</Rainfall>
</Weather>
<Weather>
<Type>observation</Type>
<Date>201411182305</Date>
<Rainfall>0.00</Rainfall>
</Weather>
<Weather>
<Type>observation</Type>
<Date>201411182315</Date>
<Rainfall>0.00</Rainfall>
</Weather>
<Weather>
<Type>observation</Type>
<Date>201411182325</Date>
<Rainfall>0.00</Rainfall>
</Weather>
<Weather>
<Type>observation</Type>
<Date>201411182335</Date>
<Rainfall>0.00</Rainfall>
</Weather>
<Weather>
<Type>observation</Type>
<Date>201411182345</Date>
<Rainfall>0.00</Rainfall>
</Weather>
<Weather>
<Type>observation</Type>
<Date>201411182355</Date>
<Rainfall>0.75</Rainfall>
</Weather>
<Weather>
<Type>forecast</Type>
<Date>201411190005</Date>
<Rainfall>1.85</Rainfall>
</Weather>
<Weather>
<Type>forecast</Type>
<Date>201411190015</Date>
<Rainfall>1.65</Rainfall>
</Weather>
<Weather>
<Type>forecast</Type>
<Date>201411190025</Date>
<Rainfall>1.05</Rainfall>
</Weather>
<Weather>
<Type>forecast</Type>
<Date>201411190035</Date>
<Rainfall>0.00</Rainfall>
</Weather>
<Weather>
<Type>forecast</Type>
<Date>201411190045</Date>
<Rainfall>0.00</Rainfall>
</Weather>
<Weather>
<Type>forecast</Type>
<Date>201411190055</Date>
<Rainfall>0.00</Rainfall>
</Weather>
</WeatherList>
</Property>
</Feature>
<Feature>
<Id>201411182255_136.88149_35.170722</Id>
<Name>地点(136.88149,35.170722)の2014年11月18日 22時55分から120分間の天気情報</Name>
<Geometry>
<Type>point</Type>
<Coordinates>136.88149,35.170722</Coordinates>
</Geometry>
<Property>
<WeatherAreaCode>5110</WeatherAreaCode>
<WeatherList>
<Weather>
<Type>observation</Type>
<Date>201411182255</Date>
<Rainfall>0.00</Rainfall>
</Weather>
<Weather>
<Type>observation</Type>
<Date>201411182305</Date>
<Rainfall>0.00</Rainfall>
</Weather>
<Weather>
<Type>observation</Type>
<Date>201411182315</Date>
<Rainfall>0.00</Rainfall>
</Weather>
<Weather>
<Type>observation</Type>
<Date>201411182325</Date>
<Rainfall>0.00</Rainfall>
</Weather>
<Weather>
<Type>observation</Type>
<Date>201411182335</Date>
<Rainfall>0.00</Rainfall>
</Weather>
<Weather>
<Type>observation</Type>
<Date>201411182345</Date>
<Rainfall>0.00</Rainfall>
</Weather>
<Weather>
<Type>observation</Type>
<Date>201411182355</Date>
<Rainfall>0.00</Rainfall>
</Weather>
<Weather>
<Type>forecast</Type>
<Date>201411190005</Date>
<Rainfall>0.00</Rainfall>
</Weather>
<Weather>
<Type>forecast</Type>
<Date>201411190015</Date>
<Rainfall>0.00</Rainfall>
</Weather>
<Weather>
<Type>forecast</Type>
<Date>201411190025</Date>
<Rainfall>0.00</Rainfall>
</Weather>
<Weather>
<Type>forecast</Type>
<Date>201411190035</Date>
<Rainfall>0.00</Rainfall>
</Weather>
<Weather>
<Type>forecast</Type>
<Date>201411190045</Date>
<Rainfall>0.00</Rainfall>
</Weather>
<Weather>
<Type>forecast</Type>
<Date>201411190055</Date>
<Rainfall>0.00</Rainfall>
</Weather>
</WeatherList>
</Property>
</Feature>
</YDF>
output=json の場合
リクエストURL。
http://weather.olp.yahooapis.jp/v1/place?appid=<YOUR APPLICATION ID>&past=1&interval=10&coordinates=136.730442,36.6577659%20136.881487,35.1707221&output=json
実際のレスポンスデータを整形したものを以下に貼っておく。
{
"ResultInfo": {
"Count": 2,
"Total": 2,
"Start": 1,
"Status": 200,
"Latency": 0.007229,
"Description": "",
"Copyright": "(C) Yahoo Japan Corporation."
},
"Feature": [
{
"Id": "201411182255_136.73044_36.657766",
"Name": "地点(136.73044,36.657766)の2014年11月18日 22時55分から120分間の天気情報",
"Geometry": {
"Type": "point",
"Coordinates": "136.73044,36.657766"
},
"Property": {
"WeatherAreaCode": 5610,
"WeatherList": {
"Weather": [
{
"Type": "observation",
"Date": "201411182255",
"Rainfall": 0
},
{
"Type": "observation",
"Date": "201411182305",
"Rainfall": 0
},
{
"Type": "observation",
"Date": "201411182315",
"Rainfall": 0
},
{
"Type": "observation",
"Date": "201411182325",
"Rainfall": 0
},
{
"Type": "observation",
"Date": "201411182335",
"Rainfall": 0
},
{
"Type": "observation",
"Date": "201411182345",
"Rainfall": 0
},
{
"Type": "observation",
"Date": "201411182355",
"Rainfall": 0.75
},
{
"Type": "forecast",
"Date": "201411190005",
"Rainfall": 1.85
},
{
"Type": "forecast",
"Date": "201411190015",
"Rainfall": 1.65
},
{
"Type": "forecast",
"Date": "201411190025",
"Rainfall": 1.05
},
{
"Type": "forecast",
"Date": "201411190035",
"Rainfall": 0
},
{
"Type": "forecast",
"Date": "201411190045",
"Rainfall": 0
},
{
"Type": "forecast",
"Date": "201411190055",
"Rainfall": 0
}
]
}
}
},
{
"Id": "201411182255_136.88149_35.170722",
"Name": "地点(136.88149,35.170722)の2014年11月18日 22時55分から120分間の天気情報",
"Geometry": {
"Type": "point",
"Coordinates": "136.88149,35.170722"
},
"Property": {
"WeatherAreaCode": 5110,
"WeatherList": {
"Weather": [
{
"Type": "observation",
"Date": "201411182255",
"Rainfall": 0
},
{
"Type": "observation",
"Date": "201411182305",
"Rainfall": 0
},
{
"Type": "observation",
"Date": "201411182315",
"Rainfall": 0
},
{
"Type": "observation",
"Date": "201411182325",
"Rainfall": 0
},
{
"Type": "observation",
"Date": "201411182335",
"Rainfall": 0
},
{
"Type": "observation",
"Date": "201411182345",
"Rainfall": 0
},
{
"Type": "observation",
"Date": "201411182355",
"Rainfall": 0
},
{
"Type": "forecast",
"Date": "201411190005",
"Rainfall": 0
},
{
"Type": "forecast",
"Date": "201411190015",
"Rainfall": 0
},
{
"Type": "forecast",
"Date": "201411190025",
"Rainfall": 0
},
{
"Type": "forecast",
"Date": "201411190035",
"Rainfall": 0
},
{
"Type": "forecast",
"Date": "201411190045",
"Rainfall": 0
},
{
"Type": "forecast",
"Date": "201411190055",
"Rainfall": 0
}
]
}
}
}
]
}
資料
ref. YOLP(地図):気象情報API - Yahoo!デベロッパーネットワーク
tags: yahoo_maps_api
Posted by NI-Lab. (@nilab)