長野県の市町村のポリゴン(KML)をマップ上に表示する

説明

市町村を地図で指し示したい場合があります。ここで使用しているのは軽量なKMLで記述された長野県の市町村ポリゴンデータで、これを読み込みマップ上に表示しています。ただし、あまり精度が高くないのでズームレベルを大きくしないようにしてください(ズームレベル10まではたえられます)。(サンプルをダウンロード

サンプルプログラム

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="ja">
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAasAJryKxWJnBFVJa487d9hTHGAxTVT7IRADYa-JdYz7xQ8IQZBSthgDZdggYpQHsmm6WYtHstQFfLA" type="text/javascript"></script>
<script type="text/javascript"><!--
window.onload = function(){
map = new GMap2(document.getElementById("gmap"));
map.setCenter(new GLatLng(36.109033596783135, 137.9608154296875), 8);
map.addControl(new GLargeMapControl());
}
function disp(url){
var kml = new GGeoXml("http://www.openspc2.org/testgmap/nagano/KML/"+url+"?time="+(new Date()).getTime());
map.addOverlay(kml);
}
// --></script>

<title>長野県の市町村のポリゴン(KML)をマップ上に表示</title>
</head>
<body>
<div id="gmap" style="width:450px;height:450px"></div>
<ol style="position:absolute;top:10px;left:470px;">
<li><a href="javascript:disp('city/azumino.kml')">安曇野市</li>
<li><a href="javascript:disp('city/chikuma.kml')">千曲市</li>
<li><a href="javascript:disp('city/chino.kml')">茅野市</li>
<li><a href="javascript:disp('city/iida.kml')">飯田市</li>
<li><a href="javascript:disp('city/iiyama.kml')">飯山市</li>
<li><a href="javascript:disp('city/ina.kml')">伊那市</li>
<li><a href="javascript:disp('city/komanage.kml')">駒ヶ根市</li>
<li><a href="javascript:disp('city/komoro.kml')">小諸市</li>
<li><a href="javascript:disp('city/matsumoto.kml')">松本市</li>
<li><a href="javascript:disp('city/nagano.kml')">長野市</li>
<li><a href="javascript:disp('city/nakano.kml')">中野市</li>
<li><a href="javascript:disp('city/okaya.kml')">岡谷市</li>
<li><a href="javascript:disp('city/omachi.kml')">大町市</li>
<li><a href="javascript:disp('city/saku.kml')">佐久市</li>
<li><a href="javascript:disp('city/shiojiri.kml')">塩尻市</li>
<li><a href="javascript:disp('city/suwa.kml')">諏訪市</li>
<li><a href="javascript:disp('city/suzaka.kml')">須坂市</li>
<li><a href="javascript:disp('city/toumi.kml')">東御市</li>
<li><a href="javascript:disp('city/ueda.kml')">上田市</li>
</ol>
<ol style="position:absolute;top:10px;left:590px;" start="20">
<li><a href="javascript:disp('town/agematsu.kml')">上松町</li>
<li><a href="javascript:disp('town/anan.kml')">阿南町</li>
<li><a href="javascript:disp('town/fujimi.kml')">富士見町</li>
<li><a href="javascript:disp('town/hata.kml')">波田町</li>
<li><a href="javascript:disp('town/iiduna.kml')">飯綱町</li>
<li><a href="javascript:disp('town/iijima.kml')">飯島町</li>
<li><a href="javascript:disp('town/ikeda.kml')">池田町</li>
<li><a href="javascript:disp('town/karuizawa.kml')">軽井沢町</li>
<li><a href="javascript:disp('town/kiso.kml')">木曽町</li>
<li><a href="javascript:disp('town/koumi.kml')">小海町</li>
<li><a href="javascript:disp('town/matsukawa.kml')">松川町</li>
<li><a href="javascript:disp('town/minowa.kml')">箕輪町</li>
<li><a href="javascript:disp('town/miyota.kml')">御代田町</li>
<li><a href="javascript:disp('town/nagawa.kml')">長和町</li>
<li><a href="javascript:disp('town/nagiso.kml')">南木曽町</li>
<li><a href="javascript:disp('town/obuse.kml')">小布施町</li>
<li><a href="javascript:disp('town/sakaki.kml')">坂城町</li>
<li><a href="javascript:disp('town/sakuho.kml')">佐久穂町</li>
<li><a href="javascript:disp('town/shimosuwa.kml')">下諏訪町</li>
<li><a href="javascript:disp('town/shinano.kml')">信濃町</li>
<li><a href="javascript:disp('town/shinshushinmachi.kml')">信州新町</li>
<li><a href="javascript:disp('town/takamori.kml')">高森町</li>
<li><a href="javascript:disp('town/tateshina.kml')">立科町</li>
<li><a href="javascript:disp('town/tatsuno.kml')">辰野町</li>
<li><a href="javascript:disp('town/yamanouchi.kml')">山ノ内町</li>
</ol>
<ol style="position:absolute;top:10px;left:700px;" start="45">
<li><a href="javascript:disp('village/achi.kml')">阿智村</li>
<li><a href="javascript:disp('village/aoki.kml')">青木村</li>
<li><a href="javascript:disp('village/asahi.kml')">朝日村</li>
<li><a href="javascript:disp('village/chikuhoku.kml')">筑北村</li>
<li><a href="javascript:disp('village/hakuba.kml')">白馬村</li>
<li><a href="javascript:disp('village/hara.kml')">原村</li>
<li><a href="javascript:disp('village/hiraya.kml')">平谷村</li>
<li><a href="javascript:disp('village/ikusaka.kml')">生坂村</li>
<li><a href="javascript:disp('village/kawakami.kml')">川上村</li>
<li><a href="javascript:disp('village/kijimadaira.kml')">木島平村</li>
<li><a href="javascript:disp('village/kiso.kml')">木祖村</li>
<li><a href="javascript:disp('village/kitaaiki.kml')">北相木村</li>
<li><a href="javascript:disp('village/matsukawa.kml')">松川村</li>
<li><a href="javascript:disp('village/minamiaiki.kml')">南相木村</li>
<li><a href="javascript:disp('village/minamimaki.kml')">南牧村</li>
<li><a href="javascript:disp('village/minamiminowa.kml')">南箕輪村</li>
<li><a href="javascript:disp('village/miyada.kml')">宮田村</li>
<li><a href="javascript:disp('village/nakagawa.kml')">中川村</li>
<li><a href="javascript:disp('village/nakajyo.kml')">中条村</li>
<li><a href="javascript:disp('village/neba.kml')">根羽村</li>
<li><a href="javascript:disp('village/nozawaonsen.kml')">野沢温泉村</li>
<li><a href="javascript:disp('village/ogawa.kml')">小川村</li>
<li><a href="javascript:disp('village/omi.kml')">麻績村</li>
<li><a href="javascript:disp('village/ookuwa.kml')">大桑村</li>
<li><a href="javascript:disp('village/ooshika.kml')">大鹿村</li>
<li><a href="javascript:disp('village/otari.kml')">小谷村</li>
<li><a href="javascript:disp('village/outaki.kml')">王滝村</li>
<li><a href="javascript:disp('village/sakae.kml')">栄村</li>
<li><a href="javascript:disp('village/seinaiji.kml')">清内路村</li>
<li><a href="javascript:disp('village/shimojyou.kml')">下條村</li>
<li><a href="javascript:disp('village/takagi.kml')">喬木村</li>
<li><a href="javascript:disp('village/takayama.kml')">高山村</li>
<li><a href="javascript:disp('village/tenryu.kml')">天龍村</li>
<li><a href="javascript:disp('village/toyooka.kml')">豊丘村</li>
<li><a href="javascript:disp('village/urugi.kml')">売木村</li>
<li><a href="javascript:disp('village/yamagata.kml')">山形村</li>
<li><a href="javascript:disp('village/yasuoka.kml')">泰阜村</li>
</ol>
</body>
</html>

サンプルを実行
[戻る]