-
Notifications
You must be signed in to change notification settings - Fork 6
/
example.html
61 lines (53 loc) · 1.6 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
54
55
56
57
58
59
60
61
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Leaflet Grid Demo</title>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.3.1/dist/leaflet.css" />
<style type="text/css">
html, body { width: 100%; height: 100%; margin: 0; }
#map { width: 100%; height: 100%; }
.grid-label { text-shadow: 2px 2px 5px #fff, -2px -2px 5px #fff; }
.vertical { transform: rotate(-90deg); }
</style>
</head>
<body>
<div id="map"></div>
<script src="https://unpkg.com/leaflet@1.3.1/dist/leaflet.js"></script>
<script src="./mgrs.js"></script>
<script src="./leaflet-grids.js"></script>
<script src="./leaflet-control.js"></script>
<script type="text/javascript">
var map = L.map('map', {
center: [51, 3],
zoom: 16
});
L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
attribution: '© <a href="https://openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
// if gridType is 'metric' or 'imperial', scale shows also the gridSize
// otherwise, normal scale is displayed
var options = {
gridType: 'distance',
showMetric: false,
};
var scale = L.control.gridscale(options);
scale.addTo(map);
/*
* Distance Grids
*/
//L.grids.distance.metric().addTo(map);
L.grids.distance.imperial().addTo(map);
/*
* LatLng Grids
*/
//L.grids.dms().addTo(map);
//L.grids.dd().addTo(map);
/*
* UTM Grids (MGRS and UTM labelling system)
*/
//L.grids.mgrs().addTo(map);
//L.grids.utm().addTo(map);
</script>
</body>
</html>