-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
136 lines (119 loc) · 4.75 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="js/leaflet.css" />
<script src="js/leaflet.js" type="text/javascript"></script>
<script src="js/leaflet.utfgrid.js" type="text/javascript"></script>
<style type="text/css">
html,
body {
height: 100%;
overflow: hidden;
}
#map {
height: 100%;
}
</style>
<title>test map</title>
<style type="text/css">
#map {
width: 100%;
height: 98vh;
}
</style>
</head>
<body>
<div id="map"></div>
<script type="text/javascript">
var map = new L.Map('map', {
center: [52.3773, 4.8889],
zoom: 8,
maxzoom: 22
});
// L.tileLayer('http://{s}.basemaps.cartocdn.com/light_nolabels/{z}/{x}/{y}.png', {
// attribution: 'Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community'
// }).addTo(map);
// L.tileLayer('http://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png', {
// attribution: 'Tiles courtesy of <a href="http://hot.openstreetmap.org/" target="_blank">Humanitarian OpenStreetMap Team</a>'
// }).addTo(map);
// L.tileLayer('http://localhost:8888/world/{z}/{x}/{y}.png', {
// attribution: 'Tiles courtesy of <a href="http://www.tno.nl/" target="_blank">TNO</a>.'
// }).addTo(map);
function bicycleTest() {
L.tileLayer('mainroad/{z}/{x}/{y}.png').addTo(map);
}
function bicycleTest2() {
L.tileLayer('mainroad2/{z}/{x}/{y}.png').addTo(map);
}
function bicycleTest3() {
L.tileLayer('http://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png', {
attribution: 'Tiles courtesy of <a href="http://hot.openstreetmap.org/" target="_blank">Humanitarian OpenStreetMap Team</a>'
}).addTo(map);
L.tileLayer('road/{z}/{x}/{y}.png').addTo(map);
var utfGrid = new L.UtfGrid('road/{z}/{x}/{y}.grid.json', { //.grid.json?callback={cb}
resolution: 4,
useJsonP: false
});
utfGrid.on('click', function (e) {
//click events are fired with e.data==null if an area with no hit is clicked
if (e.data) {
alert('click: ' + JSON.stringify(e.data, null, 2));
} else {
alert('click: nothing');
}
});
utfGrid.on('mouseover', function (e) {
console.log('hover: ' + JSON.stringify(e.data, null, 2));
});
utfGrid.on('mousemove', function (e) {
console.log('move: ' + JSON.stringify(e.data, null, 2));
});
utfGrid.on('mouseout', function (e) {
console.log('unhover: ' + JSON.stringify(e.data, null, 2));
});
map.addLayer(utfGrid);
}
function worldTest() {
L.tileLayer('world/{z}/{x}/{y}.png', {
attribution: 'Tiles courtesy of <a href="http://www.tno.nl/" target="_blank">TNO</a>.'
}).addTo(map);
var utfGrid = new L.UtfGrid('world/{z}/{x}/{y}.grid.json', {
resolution: 4,
useJsonP: false
});
utfGrid.on('click', function (e) {
//click events are fired with e.data==null if an area with no hit is clicked
if (e.data) {
alert('click: ' + JSON.stringify(e.data, null, 2));
} else {
alert('click: nothing');
}
});
// utfGrid.on('mouseover', function (e) {
// console.log('hover: ' + JSON.stringify(e.data, null, 2));
// });
// utfGrid.on('mousemove', function (e) {
// console.log('move: ' + JSON.stringify(e.data, null, 2));
// });
// utfGrid.on('mouseout', function (e) {
// console.log('unhover: ' + JSON.stringify(e.data, null, 2));
// });
map.addLayer(utfGrid);
}
function test_tm2() {
L.tileLayer('http://localhost:8888/test/{z}/{x}/{y}.png').addTo(map);
}
function testKidal() {
var map = L.map('map').setView([18.446218, 1.409125], 13);
L.tileLayer('http://localhost:8888/vmg_mali_kidal/{z}/{x}/{y}.png', {
maxZoom: 18,
attribution: 'TNO',
id: 'vmg_mali_kidal'
}).addTo(map);
}
worldTest();
</script>
</body>
</html>