-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.html
executable file
·144 lines (108 loc) · 5.35 KB
/
test.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
<!DOCTYPE html>
<html lang="en">
<head>
<title>Leaftlet Test - Auckland CCTV Network</title>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ=="
crossorigin=""/>
integrity="sha512-GffPMF3RvMeYyc1LWMHtK8EbPv0iNZ8/oTtHPx9/cc2ILxQ+u905qIwdpULaqDkyBKgOaB57QTMg7ztg8Jm2Og=="
crossorigin=""></script>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-142834572-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-142834572-1');
</script>
<!-- Open Street Map -->
<link rel="stylesheet" href="https://openlayers.org/en/v4.6.5/css/ol.css" type="text/css">
<script src="https://openlayers.org/en/v4.6.5/build/ol.js" type="text/javascript"></script>
<script>
var map;
var mapLat = -36.8513;
var mapLng = 174.7644;
var mapDefaultZoom = 11;
function initialize_map() {
map = new ol.Map({
target: "mapid",
layers: [
new ol.layer.Tile({
source: new ol.source.OSM({
url: "https://a.tile.openstreetmap.org/{z}/{x}/{y}.png"
})
})
],
view: new ol.View({
center: ol.proj.fromLonLat([mapLng, mapLat]),
zoom: mapDefaultZoom
})
});
}
function add_map_point(lat, lng) {
var vectorLayer = new ol.layer.Vector({
source:new ol.source.Vector({
features: [new ol.Feature({
geometry: new ol.geom.Point(ol.proj.transform([parseFloat(lng), parseFloat(lat)], 'EPSG:4326', 'EPSG:3857')),
})]
}),
style: new ol.style.Style({
image: new ol.style.Icon({
anchor: [0.5, 0.5],
anchorXUnits: "fraction",
anchorYUnits: "fraction",
src: "https://upload.wikimedia.org/wikipedia/commons/e/ec/RedDot.svg"
})
})
});
map.addLayer(vectorLayer);
}
var req = new XMLHttpRequest();
req.open("GET", "https://raw.githubusercontent.com/PaulAtKeyboard/OpenCCTV/master/data-AT-CCTV.json", false);
req.send();
var data = JSON.parse(req.responseText);
console.log(data[0]);
function make_map() {
for (rows of data) {
add_map_point(rows["Lattitude"], rows["Longitude"]);
}
}
/* Leaflet */
var mymap = L.map('mapid').setView([mapLat, mapLng], 11);
L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw', {
maxZoom: 18,
attribution: 'Map data © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' +
'<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
'Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
id: 'mapbox.streets'
}).addTo(mymap);
L.marker([mapLat, mapLng]).addTo(mymap)
.bindPopup("<b>Hello world!</b> <br/>I am a popup. <br/>").openPopup();
</script>
<style type="text/css"></style>
</head>
<body onload="initialize_map(); make_map();">
<div id="mapid" style="position: absolute; width: 100vw; height: 100vh; left: 0; top: 0"></div>
<!--
<div style="position: absolute; width: 50vw; height: 100vh; right: 0; top: 0; background-color: #222; color: #efefef; font-family: sans-serif; line-height: 10vh; text-align: center; font-size: 42pt;">Public Security Cameras around Auckland</div>
-->
</body>
</html>
<!--
## Disclaimer
### This Project is just for fun.
* AUTHORS MAKE NO GUARANTEE OF VALIDITY
* PLEASE BE AWARE THAT ANY INFORMATION YOU MAY FIND MAY BE INACCURATE, MISLEADING, DANGEROUS, ADDICTIVE, UNETHICAL.
* DO NOT RELY UPON ANY INFORMATION FOUND WITHOUT INDEPENDENT VERIFICATION.
* Information on this website has been derived from various sources.
* All information should be considered as being illustrative and indicative only. Your use of information from this website is entirely at your own risk.
* Authors does not give and expressly disclaims any warranty as to the accuracy or completeness of the information or its fitness for any purpose.
* Auckland Council accepts no liability for any error, omission, or inaccuracy of the information or from any use of or reliance on the information provided.
* You should independently verify the accuracy of any information before taking any action in reliance upon it.
* You waive and release Authors of this Project from any claims arising from your use of this website or the information provided by it.
* You indemnify Authors of this Project against all claims, loss or damages arising in connection with your use of the information provided.
* Information from this Project may not be used for the purposes of any legal disputes.
-->