-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathTileLayerWithMask.html
More file actions
45 lines (41 loc) · 1.45 KB
/
TileLayerWithMask.html
File metadata and controls
45 lines (41 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>TileLayerWithMask for leaflet 2.0.0-alpha.1</title>
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0" />
<link href="https://unpkg.com/leaflet@2.0.0-alpha.1/dist/leaflet.css" rel="stylesheet" />
<script type="importmap">
{
"imports": {
"leaflet": "https://unpkg.com/leaflet@2.0.0-alpha.1/dist/leaflet.js",
"mask": "./TileLayerWithMask.js"
}
}
</script>
</head>
<body>
<div id="map" style="position: absolute; top: 0; left: 0; right: 0; bottom: 0"></div>
<script type="module">
import { Map, TileLayer } from "leaflet";
import TileLayerWithMask from "mask";
const map = new Map("map").setView([35.6323, 139.768815], 15);
new TileLayer("https://cyberjapandata.gsi.go.jp/xyz/pale/{z}/{x}/{y}.png", {
maxZoom: 18,
attribution: '<a href="https://maps.gsi.go.jp/development/ichiran.html">GSI pale</a>',
}).addTo(map);
const mask = new TileLayerWithMask(
"https://cyberjapandata.gsi.go.jp/xyz/seamlessphoto/{z}/{x}/{y}.jpg",
{
maxZoom: 18,
attribution:
'<a href="https://maps.gsi.go.jp/development/ichiran.html">GSI seamlessphoto</a>',
maskSize: 800,
}
).addTo(map);
map.on("pointermove", function (e) {
mask.setCenter(e.containerPoint);
});
</script>
</body>
</html>