前提・実現したいこと
leafletを用いて、国土地理院の標準地図に、地域標準メッシュを表示したいと苦労しています。
該当のソースコード
標準地図の表示は次のHtmlでできています。
国土地理院に照会し、地域メッシュが
https://cyberjapandata.gsi.go.jp/xyz/chiikimesh/{z}/{x}/{y}.geojson
であることはわかりましたが、これをどのように使うのかかがわかりません。
<!-- plugin --> <style> body {padding: 0; margin: 0} html, body, #mapdiv {height: 100%; width: 100%;} .leaflet-container {background: #fff;} .leaflet-div-icon {background: none;white-space: nowrap;border:none;} </style> </head> <body> <div id="mapdiv"> <script> function geojson_style(prop) { var s = {}; for(name in prop) { if(name.match(/^_/) && !name.match(/_markerType/)){ if( prop['_markerType']=='Circle' && name =='_radius'){continue;} s[name.substr(1)]=prop[name]; } } return s; }<script src='https://api.mapbox.com/mapbox.js/plugins/leaflet-fullscreen/v1.0.1/Leaflet.fullscreen.min.js'></script> <link href='https://api.mapbox.com/mapbox.js/plugins/leaflet-fullscreen/v1.0.1/leaflet.fullscreen.css' rel='stylesheet' />
function popup_properties(prop) {
var s = ''
for(name in prop) {
if(!name.match(/^_/)){
s += name + ":" + prop[name] + "<br>";
}
}
return s;
}
//背景地図設定
var std = L.tileLayer(
'https://cyberjapandata.gsi.go.jp/xyz/std/{z}/{x}/{y}.png',
{
attribution: "<a href='http://maps.gsi.go.jp/development/ichiran.html' target='_blank'>地理院タイル(標準地図)</a>",
maxNativeZoom: 18,
maxZoom: 18,
opacity:1
}
);
var map = L.map('mapdiv', {
center: [36.8945944,138.0835374], zoom: 12, layers: [std]
})
L.control.scale({imperial: false}).addTo(map);
var baseLayers = {"地理院タイル(標準地図)": std};
map.addControl(new L.Control.Fullscreen({
title: {
'false': '最大化',
'true': '元に戻す'
}
}));
あなたの回答
tips
プレビュー