-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcs.js
85 lines (62 loc) · 2.25 KB
/
cs.js
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
var acc = document.getElementsByClassName("accordion");
var i;
var coords = [29.801902, -95.365821];
var ocoords = [29.801902, -95.365821];
var ncoords = [29.801902, -95.365821];
var scoords = [29.801902, -95.365821];
var events = [];
var mymap = L.map('mapid').setView(coords, 17);
var OpenStreetMap_Mapnik = L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',{
maxZoom: 19,
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
}).addTo(mymap);
/*
L.CRS.EPSG3857.unproject = function (point){ // Point -> LatLng
var earthRadius = 6378137;
projectionPoint = L.point(point).divideBy(earthRadius);
return this.projection.unproject(projectionPoint);
};
*/
var events = data; // JSON.parse(data)
for(i = 0; i < events.length; i++){
if ( events[i].attributes.Premise_Type !== "Residence or House" ) {
if ( events[i].attributes.SNB_No == 51 ||
events[i].attributes.SNB_No == 45 ||
events[i].attributes.SNB_No == 13 ||
events[i].attributes.SNB_No == 15 ||
events[i].attributes.SNB_No == 48 ||
events[i].attributes.SNB_No == 51 ||
events[i].attributes.SNB_No == 12 ||
events[i].attributes.SNB_No == 46
)
{
// console.log("events[", i,"] ", events[i],"x", events[i].geometry.x);
ocoords[0] = events[i].geometry.x;
ocoords[1] = events[i].geometry.y;
// console.log("ocoords",ocoords);
var point = new L.Point(events[i].geometry.x, events[i].geometry.y);
// console.log("point",point);
// var earthRadius = 6378137;
var latlng = L.Projection.SphericalMercator.unproject(
point); //.divideBy(earthRadius));
console.log("latlng",latlng); //returns latlon
new L.Marker([latlng.lat, latlng.lng],{bounceOnAdd: true}).addTo(mymap);
}
}
};
/* var events = JSON.parse(raw);
alert(events[0].Offense);
alert(events[1].Offense);
for (i = 0; i < acc.length; i++){
acc[i].onclick = function(){
this.classList.toggle("active");
this.nextElementSibling.classList.toggle("show");
}
}
test = new Date()
month = test.getMonth()
month = (month * 1) + 1
day = test.getDate()
year = test.getFullYear()
document.write(" ",month,"/",day,"/",year," ")
*/