forked from mikeskaug/Leaflet.Legend
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathexample.html
53 lines (47 loc) · 1.68 KB
/
example.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
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Leaflet legend debug page.</title>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" crossorigin=""/>
<script src="https://unpkg.com/[email protected]/dist/leaflet-src.js" crossorigin=""></script>
<style type="text/css">
.container {
width: 800px;
margin-left: auto;
margin-right: auto;
}
#map { width: 100%; height: 400px; }
textarea {
width: 100%; height: 150px;
}
</style>
</head>
<body>
<div class="container">
<h1>Leaflet legend</h1>
<a href="https://github.com/zostera/leaflet-legend/">zostera/leaflet-legend</a>
<br /><br />
<div id="map"></div>
</div>
<link rel="stylesheet" href="./leaflet-legend.css" />
<script src="./leaflet-legend.js"></script>
<script type="text/javascript">
var map = L.map('map').setView([52, 4], 8);
L.tileLayer('http://{s}.tile.stamen.com/toner-lite/{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 © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>',
subdomains: 'abcd',
minZoom: 0,
maxZoom: 20,
}).addTo(map);
L.marker([52.5, 4.75]).addTo(map);
L.control.legend({
items: [
{color: 'red', label: 'reserved'},
{color: 'blue', label: 'not reserved'}
],
collapsed: true
}).addTo(map);
</script>
</body>
</html>