forked from QuantStack/leaflet-splitmap
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.html
66 lines (58 loc) · 2.07 KB
/
index.html
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui' />
<title>Leaflet Compare</title>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css"
integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A=="
crossorigin=""/>
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"
integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA=="
crossorigin=""></script>
<link rel="stylesheet" href="dist/leaflet-compare.css" />
<script src="dist/leaflet-compare.js"></script>
<style>
body {
margin: 0;
padding: 0;
}
#map {
position: absolute;
top: 0;
bottom: 0;
width: 100%;
}
</style>
</head>
<body>
<div id='map'></div>
<script>
const map = L.map('map').setView([51.505, -0.09], 13);
const osmLayer = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '© <a href="http://osm.org/copyright">OpenStreetMap<\/a> contributors'
}).addTo(map);
const stamenLayer = L.tileLayer('//stamen-tiles-{s}.a.ssl.fastly.net/watercolor/{z}/{x}/{y}.png', {
attribution:
'Map tiles by <a href="http://stamen.com">Stamen Design<\/a>, ' +
'<a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0<\/a> — ' +
'Map data {attribution.OpenStreetMap}',
minZoom: 1,
maxZoom: 16
}).addTo(map)
map.createPane("left")
map.createPane("right")
const leftCircle = L.circle([51.505, -0.09], {
pane: "left",
radius: 1000,
color: "#ff0000"
}).addTo(map);
const rightCircle = L.circle([51.505, -0.09], {
pane: "right",
radius: 1000,
color: "#0000ff"
}).addTo(map);
const compare = L.control.compare([leftCircle, stamenLayer], [rightCircle, osmLayer]).addTo(map);
</script>
</body>
</html>