Skip to content

Commit

Permalink
volcano and wildfire table added
Browse files Browse the repository at this point in the history
  • Loading branch information
Harold Garbeil authored and Harold Garbeil committed Jun 10, 2024
1 parent 288c79a commit b8799a7
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 3 deletions.
57 changes: 57 additions & 0 deletions fire_perim.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const acreTF = document.getElementById ("acreField") ;
let fireHeadings = ['Name','Size (Acres)','Behavior','Percent Contained','Report Time','Description'];
let fireurl = 'https://services3.arcgis.com/T4QMspbfLg3qTGWY/arcgis/rest/services/WFIGS_Interagency_Perimeters_Current/FeatureServer/jobs/a9af9310-bf0a-41eb-9e7a-9db590421661?f=json';


Expand Down Expand Up @@ -31,6 +32,7 @@ fetch (fireurl).then(res=>res.json())
if (fsize < minAcreage){
continue ;
}
console.log(f);
let mymark = L.geoJSON(f, {
style: {color:"#ff0000"},

Expand All @@ -48,11 +50,66 @@ fetch (fireurl).then(res=>res.json())
mymark.addTo(map);
firemarks.push(mymark) ;
}
if (tableMode ==2){
console.log("load fires") ;
loadFiresTable(fires, minAcreage) ;
}
});

}

);
}

function loadFiresTable (fires, minAcreage){
console.log("creating fire table") ;
let tableEl = document.getElementById('toptable') ;

tableEl.innerHTML="";
theadEl.innerHTML="" ;
tbodyEl.innerHTML="" ;

let myTr = document.createElement("tr") ;
myTr.classList.add('tr-head') ;
for (i in fireHeadings) {
let myTh = document.createElement('th') ;
myTh.innerHTML = fireHeadings[i] ;
if (i==2 || i==3){
myTh.classList.add('priority-low');
}
myTr.appendChild(myTh) ;
}
theadEl.appendChild(myTr) ;
for (i in fires.features){
f = fires.features[i];
let fsize = f.properties.attr_IncidentSize ;
if (fsize < minAcreage)
continue ;
let myTr = document.createElement("tr") ;
let myTd0 = document.createElement('td') ;
myTd0.innerHTML = f.properties.poly_IncidentName ;
myTr.appendChild (myTd0);
myTd0 = document.createElement('td') ;
myTd0.innerHTML = fsize ;
myTr.appendChild (myTd0);
myTd0 = document.createElement('td') ;
myTd0.innerHTML = f.properties.attr_FireBehaviorGeneral;
myTr.appendChild (myTd0);
myTd0 = document.createElement('td') ;
myTd0.innerHTML = f.properties.attr_PercentContained;
myTr.appendChild (myTd0);
myTd0 = document.createElement('td') ;
myTd0.innerHTML = f.properties.attr_ICS209ReportDateTime;
myTr.appendChild (myTd0);
myTd0 = document.createElement('td') ;
myTd0.innerHTML = f.properties.attr_IncidentShortDescription;
myTr.appendChild (myTd0);
tbodyEl.appendChild(myTr);

}
tableEl.appendChild(theadEl);
tableEl.appendChild(tbodyEl);
}


loadFires() ;
8 changes: 5 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreet
$( document ).ready(function(){
$("#event_show_cb").on("change", "input:checkbox", function(){
//$("#formname").submit();
console.log("event cb hit") ;
getEvents();
});
});
Expand Down Expand Up @@ -68,12 +67,17 @@ function openType(evt, type) {
case 'equake':
tableMode = 0 ;
tableMode = 0 ;
updateQuakes() ;
break ;
case 'volc' :
tableMode = 1 ;
getFlags() ;
loadVolcs() ;
break ;
case 'wildf' :
tableMode = 2 ;
loadFires() ;
break ;

}
}
Expand Down Expand Up @@ -196,8 +200,6 @@ function createQuakeTable (qdata) {
let myTr = document.createElement("tr") ;
myTr.classList.add('tr-head') ;



for (i in quakeHeadings) {
let myTh = document.createElement('th') ;
myTh.innerHTML = quakeHeadings[i] ;
Expand Down

0 comments on commit b8799a7

Please sign in to comment.