KML and GeoRSS Support Added to the Google Maps APIを眺めながら何か作ってみようかと考えた。地図にマップするといえば、天気だなぁということで、お天気RSSで何かできないものかと、フィードを提供しているところを探してみた。
調べてみたら、つい最近、Yahoo!JAPANが配信開始してたみたいです。まぁ、いまさら感がかなり漂うけれども。Livedoorが天気RSSを配信開始したのが2006年2月ということで、そこから1年遅れ。
どこがお天気RSSを配信してるのか、google先生に聞いてみる。国内だと概ねここらへん
各プロバイダで提供されるフィードの種類
ここから、地域別のデータは福岡県福岡地方を指してます。特に意図はないですが。
比較する意味が無いくらい、Livedoorが群を抜いて網羅。そして、ウェザーマップの特色が出ています。
- 全国: 全国の情報が全部含まれる (地震など時系列なものはこれ)
- 地域下: 九州地方などで、その下の都道府県レベル(都道府県庁所在地かな?)の各所の天気
- 都道府県レベル: 都道府県庁所在地基準の天気
- 都道府県下: 福岡県などで、その下の地区レベルの各測定所でのデータ
LD | Y! | goo | wm | |
---|---|---|---|---|
今日・明日の天気 (全国主要地) | ○ | × | × | × |
今日・明日の天気 (地域下) | ○ | ○ | × | × |
今日・明日の天気 (地区レベル) | − | − | ○ | − |
週間天気 (都道府県レベル)※1 | − | ○※2 | − | − |
週間天気(今日から1週間分) (地区レベル) | ○ | ○※2 | × | − |
地区天気+いろいろ※3 | × | × | × | ○ |
現時点のアメダス・気温(都道府県下) | ○ | × | × | × |
現時点のアメダス・降水量(都道府県下) | ○ | × | × | × |
現時点のアメダス・風向風速(都道府県下) | ○ | × | × | × |
現時点のアメダス・日照時間(都道府県下) | ○ | × | × | × |
現時点のアメダス・積雪深(都道府県下) | ○ | × | × | × |
警報注意報(都道府県下) | ○ | ○ | × | × |
地震情報(全国) | ○ | × | × | × |
津波情報(全国) | ○ | × | ○ | × |
火山情報(全国) | ○ | × | × | × |
警報・注意報(全国) | ○ | × | × | × |
※1: 別に自分で都道府県庁所在地の地区のフィードを読みに行けばよいので無くてよい。というか、実体同じ(w
※2: 警報・注意報を含む
※3: 都道府県の天気概況と、地区の今日の天気、明日の天気、3時間ごとの天気と気温、週間予報、さらに天気予報士によるお天気コメント
地域コード
ページやフィードのURLを眺めていると、ライブドアを除いて、福岡県は福岡県福岡地方は8210を指すことが分かります。都道府県のコードについては、一般的な都道府県コード(福岡県は40)を使っているところと、天気の地域コードの上(福岡県だと、82)を使っているサイトもあります。(tenki.jp) ただ、この天気コードは、だいたい都道府県で分かれているけど、北海道は道南は2x、その他が1x、離島とか本島とかけ離れた番号が振られていたり、都道府県にマップさせるにはちと厳しい感じです。
ウェザーニュースや気象庁のサイトだと、この採番はしてないのでJWA(か、その上流)のデータソース固有のコードだと思います。(Livedoorの情報提供元のハレックスブレインも同じく。JWAの子会社だから) 仕様書や一覧表が見あたらないのでスクレイピングして対応表を作る必要がありそう。
ライブドアは、1次細分区定義表というので、地域コードの定義を公開しています。(しかし、なんでこれRSSフォーマット?) 明らかに連番なのが、ちと不安な感じではあります。
あんまり、お天気の地域の追加・削除は聴いたことがないので、それでいいのかもしれません。
各プロバイダのフォーマット
天気をRSSリーダに登録するってのは正直無い感じがします。再加工しにくくて、ただ読むだけなら普通にサイト見ればいーじゃんと。ということで、再加工しやすさすそうなのというのに着目して、実際の中身について比較してみます。
goo
<?xml version="1.0" encoding="utf-8"?> <rss xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0"> <channel> <title>福岡(福岡)の天気 - goo 天気</title> <link>http://weather.goo.ne.jp/area/8210.html</link> <language>ja</language> <lastBuildDate>Sat, 24 Mar 2007 17:52:06 +0900</lastBuildDate> <item> <title>明日(3/25)の天気「晴れ」 - goo 天気</title> <link>http://weather.goo.ne.jp/area/8210.html</link> <description>晴れ</description> <content:encoded><![CDATA[ HTMLで整形されたデータ ]]></content:encoded> <pubDate>Sat, 24 Mar 2007 17:52:06 +0900</pubDate> </item> <pubDate>Sat, 24 Mar 2007 17:52:06 +0900</pubDate> <guid isPermaLink="false">PM JST+9 Sat Mar 24 2007</guid> </channel> </rss>
ウェザーマップ
- http://feeds.feedburner.jp/hitokuchi_8210
- おっと、feedburnerだ
- 天気概況が詳し目
- 独自にwm名前空間が定義されて拡張されている (DTD)
- これって一般的なもの?ここだけ?
- 注意報、1日の天気、週間天気が混ざって配信されるが、wm:forecastノードを捕まえにいけばいいね
<?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet href="http://feeds.feedburner.jp/~d/styles/rss2full.xsl" type="text/xsl" media="screen"?> <?xml-stylesheet href="http://feeds.feedburner.jp/~d/styles/itemcontent.css" type="text/css" media="screen"?> <rss xmlns:wm="http://www.weathermap.co.jp/rss/ns/forecast.dtd" xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0"> <channel> <title>福岡県福岡地方の天気予報 by ウェザーマップ</title> <link>http://www.weathermap.co.jp/</link> <description>今日明日の天気予報に、気象予報士によるわかりやすい解説「ひとくち予報」をプラス。各局で活躍するお天気キャスターも登場します。</description> <language>ja</language> <copyright>2007 (C) Weather Map Co.,Ltd</copyright> <lastBuildDate>Sat, 24 Mar 2007 21:40:32 +0900</lastBuildDate> <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.jp/hitokuchi_8210" type="application/rss+xml"/> <item> <title>雪解け注意</title> <link>http://www.weathermap.co.jp/index.php3?guid=2007032417</link> <guid isPermaLink="true">http://www.weathermap.co.jp/index.php3?guid=2007032417</guid> <pubDate>Sat, 24 Mar 2007 17:34:54 +0900</pubDate> <description> 天気概況(詳しめ) </description> <content:encoded><![CDATA[ HTMLで整形されたデータ (gooより詳しめ) ]]></content:encoded> </item> <item> <title>福岡県の天気概況</title> <link>http://www.weathermap.co.jp/rss/hitokuchi/gaikyo/807.html?guid=2007032417</link> <guid isPermaLink="true">http://www.weathermap.co.jp/rss/hitokuchi/gaikyo/807.html?guid=2007032417</guid> <pubDate>Sat, 24 Mar 2007 18:59:00 +0900</pubDate> <description> 天気概況(詳しめ) </description> <content:encoded><![CDATA[ HTMLで整形されたデータ ]]></content:encoded> </item> <item> <title>3/24(土) 雨のちくもり</title> <link>http://www.weathermap.co.jp/monkeyweather/region/054.php3</link> <guid isPermaLink="false">20070324178210324</guid> <pubDate>Sat, 24 Mar 2007 17:00:03 +0900</pubDate> <wm:forecast term="kyo_asu" announce="2007-03-24 17:00:00"> <wm:area> <wm:prefecture>福岡県</wm:prefecture> <wm:region>福岡地方</wm:region> <wm:city>福岡</wm:city> </wm:area> <wm:content date="3/24" wday="Sat"> <wm:weather>雨のちくもり</wm:weather> <wm:temperature unit="℃"> <wm:max>--</wm:max> <wm:min>--</wm:min> </wm:temperature> <wm:rainfall unit="%"> <wm:prob hour="18-24">50</wm:prob> </wm:rainfall> </wm:content> </wm:forecast> <description> 概要 </description> </item> <item> <title>3/25(日) 晴れ 17℃/12℃</title> <link>http://www.weathermap.co.jp/monkeyweather/region/054.php3#</link> <guid isPermaLink="false">20070324178210325</guid> <pubDate>Sat, 24 Mar 2007 17:00:02 +0900</pubDate> <wm:forecast term="kyo_asu" announce="2007-03-24 17:00:00"> <wm:area> <wm:prefecture>福岡県</wm:prefecture> <wm:region>福岡地方</wm:region> <wm:city>福岡</wm:city> </wm:area> <wm:content date="3/25" wday="Sun"> <wm:weather>晴れ</wm:weather> <wm:temperature unit="℃"> <wm:max>17</wm:max> <wm:min>12</wm:min> </wm:temperature> <wm:rainfall unit="%"> <wm:prob hour="00-06">10</wm:prob> <wm:prob hour="06-12">0</wm:prob> <wm:prob hour="12-18">0</wm:prob> <wm:prob hour="18-24">0</wm:prob> </wm:rainfall> </wm:content> </wm:forecast> <description> 概要 </description> </item> <item> <title>福岡の3時間ごとの天気と気温</title> <link>http://www.weathermap.co.jp/rss/hitokuchi/jikeiretsu/jikei_8210.html?guid=2007032417</link> <guid isPermaLink="true">http://www.weathermap.co.jp/rss/hitokuchi/jikeiretsu/jikei_8210.html?guid=2007032417</guid> <pubDate>Sat, 24 Mar 2007 17:00:01 +0900</pubDate> <description> 概要 </description> <content:encoded><![CDATA[ HTML概要 ]]></content:encoded> </item> <item> <title>福岡県福岡地方(福岡)の週間予報</title> <link>http://www.weathermap.co.jp/rss/hitokuchi/shukan/shukan_8210.html?guid=2007032417</link> <guid isPermaLink="true">http://www.weathermap.co.jp/rss/hitokuchi/shukan/shukan_8210.html?guid=2007032417</guid> <pubDate>Sat, 24 Mar 2007 17:00:00 +0900</pubDate> <wm:forecast term="week" announce="2007-03-24 17:00:00"> <wm:area> <wm:prefecture>福岡県</wm:prefecture> <wm:region>福岡地方</wm:region> <wm:city>福岡</wm:city> </wm:area> <wm:content date="3/24" wday="Sat"> <wm:weather>雨のちくもり</wm:weather> <wm:temperature unit="℃"> <wm:max>--</wm:max> <wm:min>--</wm:min> </wm:temperature> <wm:rainfall unit="%"> <wm:prob hour="18-00">50</wm:prob> </wm:rainfall> </wm:content> <wm:content date="3/25" wday="Sun"> <wm:weather>晴れ</wm:weather> <wm:temperature unit="℃"> <wm:max>17</wm:max> <wm:min>12</wm:min> </wm:temperature> <wm:rainfall unit="%"> <wm:prob hour="00-06">10</wm:prob> <wm:prob hour="06-12">0</wm:prob> <wm:prob hour="12-18">0</wm:prob> <wm:prob hour="18-00">0</wm:prob> </wm:rainfall> </wm:content> <!-- wm:content 1週間分くりかえし --> </wm:forecast> <description> 概要 </description> <content:encoded><![CDATA[ HTMLで整形されたデータ ]]></content:encoded> </item> </channel> </rss>
天気コード
tenki.jpに「晴れのち曇り」みたいなのを表すお天気コードの一覧表がありました。gooのお天気画像は、これに沿ってるみたいです。