Skip to content

Instantly share code, notes, and snippets.

@frogcat
Created September 14, 2018 10:23
Show Gist options
  • Save frogcat/362e973219ca1843002dbd0d8b6b5201 to your computer and use it in GitHub Desktop.
Save frogcat/362e973219ca1843002dbd0d8b6b5201 to your computer and use it in GitHub Desktop.
hello Leaflet.VectorGrid

hello Leaflet.VectorGrid

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello L.VectorGrid.Protobuf</title>
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0" />
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" />
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
<script src="https://unpkg.com/[email protected]/dist/Leaflet.VectorGrid.bundled.min.js"></script>
</head>
<body>
<div id="map" style="position:absolute;top:0;left:0;bottom:0;right:0;"></div>
<script>
var map = L.map("map", {
maxZoom: 19,
zoom: 15,
center: [42.7450, 141.9123]
});
L.tileLayer('https://maps.gsi.go.jp/xyz/20180906hokkaido_atsuma_0906do/{z}/{x}/{y}.png', {
attribution: "<a href='https://maps.gsi.go.jp/development/ichiran.html' target='_blank'>地理院タイル</a>",
minZoom: 10,
maxNativeZoom: 18
}).addTo(map);
L.vectorGrid.protobuf("https://wata909.github.io/atsuma_mvt/sediment/{z}/{x}/{y}.pbf", {
attribution: "<a href='https://github.com/koukita/2018_09_06_atumatyou' target='_blank'>この地図は地理院地図 平成30年北海道胆振東部地震 厚真川地区 正射画像をトレースした地図です</a>",
maxNativeZoom: 14,
minNativeZoom: 14,
maxZoom: 18,
rendererFactory: L.canvas.tile,
vectorTileLayerStyles: {
"厚真町堆積土トレース": {
color: "red",
weight: 2
}
}
}).addTo(map);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment