Loading [MathJax]/extensions/tex2jax.js

2015年9月12日土曜日

日本救急医療財団 全国AEDマップ

NHKニュース:『AEDの全国マップ 4県庁の9台が表示漏れ』
http://www3.nhk.or.jp/news/html/20150909/k10010222871000.html

このニュースで知ったのですが、AED設置箇所を地図で表示するサイトができていたのですね。

『日本救急医療財団 全国AEDマップ』
https://www.qqzaidanmap.jp/


スマートフォンでも問題なく見られますし、位置情報との連動で現在地周辺のAED設置箇所がわかるようになっています。
情報の信頼性を3段階で表示してくれるのもよさそうです(が、大半が最低ランクの箇所みたいです…)

このサイトの改善を望むとすると、次の2つでしょうか。
  • 「ようこそ」の文字が大きすぎてスマートフォンで見ると地図の表示エリアが下がってしまう。
  • 背景地図は地理院地図でなくて民間の地図のほうがよかったかも。
    • たとえば近くのAEDを見つけるとき、「コンビニの隣のビル」などというように、目印となる店や施設がわかったほうが便利なのではないか。
いずれにせよ、もしもの時のために、こういうサイトの存在を知っておくのは非常に大事なことですね。

2015年9月6日日曜日

国土地理院のベクトルタイルをOpenLayers 3で表示する

もう1か月以上前になってしまいましたが、国土地理院のベクトルタイル実証実験で全国データが提供されました。
ということで、これを地図上に表示させたい、と思うのがGISやってる人間なわけです。
で、OpenLayers 3には、TileVectorというまさにドンピシャなクラスがあって、それを使うと割と簡単にベクトルタイルを扱えます。

ソースコードはこんな感じ。ここでは、道路中心線・鉄道中心線・河川中心線を表示させています。
<!doctype html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="http://openlayers.org/en/v3.8.2/css/ol.css" type="text/css">
<style>
.map {
width: 100%;
max-width: 600px;
height: 400px;
}
.map, .control {
float: left;
}
li {
display: block;
}
</style>
<script src="http://openlayers.org/en/v3.8.2/build/ol.js" type="text/javascript"></script>
<script src="http://code.jquery.com/jquery-2.1.4.min.js" type="text/javascript"></script>
<title>地理院地図ベクトルタイル表示サンプル</title>
</head>
<body>
<h2>地理院地図ベクトルタイル表示サンプル</h2>
<div id="map" class="map"></div>
<div id="control" class="control">
<ul>
<li>
<input id="road_layer_visible" type="checkbox" onclick="changeRoadLayerVisible()" checked/>
<label for="road_layer_visible" class="visible">道路中心線</label>
</li>
<li>
<input id="rail_layer_visible" type="checkbox" onclick="changeRailLayerVisible()" checked/>
<label for="rail_layer_visible" class="visible">鉄道中心線</label>
</li>
<li>
<input id="river_layer_visible" type="checkbox" onclick="changeRiverLayerVisible()" checked/>
<label for="river_layer_visible" class="visible">河川中心線</label>
</li>
</ul>
</div>
<script type="text/javascript">
var baseLayer = new ol.layer.Tile({
source: new ol.source.XYZ({
attributions: [
new ol.Attribution({
html: "<a href='http://maps.gsi.go.jp/development/ichiran.html' target='_blank'>地理院タイル</a>"
})
],
projection: "EPSG:3857",
url: "http://cyberjapandata.gsi.go.jp/xyz/std/{z}/{x}/{y}.png"
})
});
var gsiAttribution = new ol.Attribution({
html: "<a href=\"https://github.com/gsi-cyberjapan/vector-tile-experiment\">国土地理院ベクトルタイル提供実験</a>"
});
var roadLayer = new ol.layer.Vector({
source: new ol.source.TileVector({
attributions: [gsiAttribution],
format: new ol.format.GeoJSON(),
projection: 'EPSG:3857',
tileGrid: new ol.tilegrid.createXYZ(),
url: 'http://cyberjapandata.gsi.go.jp/xyz/experimental_rdcl/{z}/{x}/{y}.geojson'
}),
style: new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'green',
width: 5,
lineCap: "butt"
})
})
});
var railLayer = new ol.layer.Vector({
source: new ol.source.TileVector({
attributions: [gsiAttribution],
format: new ol.format.GeoJSON(),
projection: 'EPSG:3857',
tileGrid: new ol.tilegrid.createXYZ(),
url: 'http://cyberjapandata.gsi.go.jp/xyz/experimental_railcl/{z}/{x}/{y}.geojson'
}),
style: new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'yellow',
width: 5,
lineCap: "butt"
})
})
});
var riverLayer = new ol.layer.Vector({
source: new ol.source.TileVector({
attributions: [gsiAttribution],
format: new ol.format.GeoJSON(),
projection: 'EPSG:3857',
tileGrid: new ol.tilegrid.createXYZ(),
url: 'http://cyberjapandata.gsi.go.jp/xyz/experimental_rvrcl/{z}/{x}/{y}.geojson'
}),
style: new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'blue',
width: 5,
lineCap: "butt"
})
})
});
var map = new ol.Map({
target: 'map',
controls: [
new ol.control.Attribution({
collapsible: false
})
],
layers: [
baseLayer,
roadLayer,
railLayer,
riverLayer
],
view: new ol.View({
center: ol.proj.transform([139.669, 35.59], 'EPSG:4326', 'EPSG:3857'),
zoom: 16,
maxZoom: 16,
minZoom: 16
})
});
function changeRoadLayerVisible() {
roadLayer.setVisible($("#road_layer_visible").prop("checked"));
}
function changeRailLayerVisible() {
railLayer.setVisible($("#rail_layer_visible").prop("checked"));
}
function changeRiverLayerVisible() {
riverLayer.setVisible($("#river_layer_visible").prop("checked"));
}
</script>
</body>
</html>