-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfirms.js
72 lines (53 loc) · 1.84 KB
/
firms.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
// let firms_url = "https://firms2.modaps.eosdis.nasa.gov/data/active_fire/modis-c6.1/csv/MODIS_C6_1_USA_contiguous_and_Hawaii_48h.csv";
let firms_url0 = "https://firms2.modaps.eosdis.nasa.gov/data/active_fire/modis-c6.1/csv/MODIS_C6_1_Global_"
let firms_marks = [] ;
const confTE = document.getElementById('confField');
const timePeriodCB = document.getElementById('timePeriodCBox');
let latval ;
let lonval ;
let confval ;
let brighttemp ;
let acqtime ;
function get_firms_hotspots(timePer, minConf) {
let firms_url = firms_url0+timePer+".csv" ;
$ajaxUtils.sendGetRequest (firms_url, function(responseText){
let lines = responseText.split("\n") ;
console.log(lines[0]);
let line0 = lines[0] ;
for (i in lines){
if (i == 0 || lines[i].length<10) {
continue ;
}
let cols = lines[i].split(',');
latval = cols[0];
lonval = cols[1];
brighttemp = cols[2];
confval = cols[8];
if (confval < minConf){
continue ;
}
acqtime = cols[5]+' '+cols[6]+" UTM";
let outstring = `${acqtime}<br>Lat: ${latval} , Lon: ${lonval}<br>Confidence : ${confval}<br>Brightness: ${brighttemp}` ;
// "latval+" , "+lonval+"<br>"+qdate+"<br>"+qplace+"<br>"+"<a target='_blank' href="+qlink+">Website</href>";
let marker = L.circleMarker([latval,lonval],{
radius:1,
color:"#A3B",
}) ;
marker.bindPopup (outstring);
marker.addTo(map);
firms_marks.push(marker);
}
},false) ;
}
function updateFIRMS() {
let timePer = timePeriodCB.value;
minConf = confTE.value ;
clearFIRMS() ;
get_firms_hotspots(timePer, minConf);
}
function clearFIRMS() {
for (marknum in firms_marks) {
map.removeLayer (firms_marks[marknum]);
}
firms_marks=[] ;
}