-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
160 lines (126 loc) · 5.21 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<!DOCTYPE html>
<html lang="cs" dir="ltr">
<head>
<title>Leaflet Heatmap</title>
<meta charset="utf-8">
<meta name="robots" content="index,follow">
<meta name="author" content="Jáchym Kellar">
<!-- <meta http-equiv='X-UA-Compatible' content='IE=edge'> -->
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js"></script>
<script src="dist/leaflet-heat.js"></script>
<link rel="stylesheet" href="css/default.css">
</head>
<body>
<div id="description">
Leaflet heatmap demo<br>
<a href="https://github.com/jachymkellar/heatmap" target="_blank">https://github.com/jachymkellar/heatmap</a>
</div>
<div id="heatmapLink">
<table class="tableLink">
<tr><td>
<img src="data/icon.jpg" alt="Link">
</td><td>
<a href="pages/heatmap_birm_lonlat_all_google.html">Show Google<br>heatmap demo</a>
</td></tr>
</table>
</div>
<div id="testButton" onClick="runTest()">Run Test</div>
<input type="radio" name="heatmap" id="heatMapOn" onclick="toggleHeatmap()" checked>
<input type="radio" name="heatmap" id="heatMapOn2" onclick="toggleHeatmap2()" checked>
<div id="heatMap">Heatmap</div>
<div id="radius">Radius</div>
<input type="range" min="1" max="30" value="13" oninput="changeRadius(this.value)" ochange="changeRadius(this.value)" id="myRange">
<div id="radiusValue">13</div>
<div id="max">Max</div>
<input type="range" min="0.1" max="4.0" value="1.0" step="0.1" oninput="changeMax(this.value)" ochange="changeMax(this.value)" id="myRange2">
<div id="radiusValue2">1.0</div>
<div id="opacity">StartOpacity</div>
<input type="range" min="0.0" max="1.0" value="0.0" step="0.1" oninput="changeOpacity(this.value)" ochange="changeOpacity(this.value)" id="myRange3">
<div id="opacityValue">0.0</div>
<div id="data">Data</div>
<select id="dataSelect" onchange="location = this.options[this.selectedIndex].value;">
<option value="pages/heatmap_1k.html">birm_lonlat_1000</option>
<option value="pages/heatmap_5k.html">birm_lonlat_5000</option>
<option value="pages/heatmap_10k.html">birm_lonlat_10000</option>
<option value="pages/heatmap_15k.html">birm_lonlat_15000</option>
<option value="pages/heatmap_20k.html">birm_lonlat_20000</option>
<option value="index.html" selected>birm_lonlat_all</option>
<option value="pages/heatmap_100k.html">lonlat100k</option>
<option value="pages/heatmap_250k.html">lonlat250k</option>
<option value="pages/heatmap_500k.html">lonlat500k</option>
<option value="pages/heatmap_750k.html">lonlat750k</option>
<option value="pages/heatmap_1000k.html">lonlat1000k</option>
</select>
<div id="blur">Blur</div>
<input type="range" min="1" max="30" value="15" step="1" oninput="changeBlur(this.value)" ochange="changeBlur(this.value)" id="myRange4">
<div id="blurValue">15</div>
<div id="map"></div>
<script src="data/birm_lonlat_all_converted.js"></script>
<script>
var map = new L.Map('map', {
center: [52.5, -1.85],
zoom: 11,
zoomControl: false
});
L.tileLayer('http://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png', {
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> © <a href="http://cartodb.com/attributions">CartoDB</a>',
subdomains: 'abcd',
maxZoom: 19
}).addTo(map);
L.control.zoom({position: 'bottomright'}).addTo(map);
addressPoints = addressPoints.map(function (p) { return [p[0], p[1]]; });
var heat = L.heatLayer(addressPoints, {
radius: 13,
max: 1.0,
gradient: {0.4: 'rgb(0, 255, 0)', 0.65: 'rgb(255, 255, 0)', 1: 'rgb(255, 0, 0)'}
}).addTo(map);
function runTest(){
var numdraw = 30
var sum = 0;
var start;
var end;
console.log("Test start");
for(i=1;i<=numdraw;i++){
map.removeLayer(heat);
console.time("draw");
start = new Date().getTime(); // ulozi pocatek
map.addLayer(heat);
end = new Date().getTime(); // ulozi konec
console.timeEnd("draw");
sum = sum +(end-start);
}
console.log("Test end");
var zoom = map.getZoom()
console.log("average: " + (sum/numdraw));
console.log("zoom: " + zoom);
}
function changeRadius(value) {
var radiusNumber = parseInt(value);
document.getElementById("radiusValue").innerHTML = radiusNumber;
heat.setOptions({radius: radiusNumber});
}
function changeMax(value){
var maximum = parseFloat(value);
document.getElementById("radiusValue2").innerHTML = maximum;
heat.setOptions({max: maximum});
}
function toggleHeatmap() {
map.removeLayer(heat);
}
function toggleHeatmap2() {
map.addLayer(heat);
}
function changeOpacity(value) {
var opacityNumber = parseFloat(value);
document.getElementById("opacityValue").innerHTML = opacityNumber;
heat.setOptions({minOpacity: opacityNumber});
}
function changeBlur(value) {
var blurNumber = parseInt(value);
document.getElementById("blurValue").innerHTML = blurNumber;
heat.setOptions({blur: blurNumber});
}
</script>
</body>
</html>