-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathda.js
More file actions
99 lines (84 loc) · 4.01 KB
/
da.js
File metadata and controls
99 lines (84 loc) · 4.01 KB
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
//PDA GeoJSON
async function GetPDAGeoJSONData() {
console.log("Fetching Forerunner GeoJSON Data");
let geojsonResponse = await fetch("https://central-ap.hernandoclerk.org/forerunner/api/damage-assessment/2024-10-07");
let geojsonData = await geojsonResponse.json();
let houseIcon = (color) => L.divIcon({
className: "custom-icon",
html: `<div style="background-color: ${color}; border-radius: 50%; width: 10px; height: 10px; text-align: center; line-height: 20px;"> </div>`,
iconSize: [10, 10],
});
L.geoJSON(geojsonData, {
pointToLayer: function (feature, latlng) {
if (feature.properties.damage == 'Major') {
color = 'red';
} else if(feature.properties.damage == 'Minor'){
color = 'orange';
} else if(feature.properties.damage == 'Affected'){
color = 'limegreen';
}else{
color = ' rgb(115, 1, 1)';
}
return L.marker(latlng, { icon: houseIcon(color) });
}
})
.bindPopup(function (layer) {
color = (layer.feature.properties.damage == 'Major') ? 'red' : 'orange';
return `Address: ${layer.feature.properties.address}<br>
Form: ${layer.feature.properties.form}<br>
Description: ${layer.feature.properties.description}<br>
Damage Cause: ${layer.feature.properties.damage}<br>
Foundation: ${layer.feature.properties.foundation}<br>
Type of Residence: ${layer.feature.properties.type_of_residence}<br>
Owner/Renter: ${layer.feature.properties.owner_renter}<br>
Use of Structure: ${layer.feature.properties.structure_use}<br>
Type of Structure: ${layer.feature.properties.type_of_structure}<br>
Superstructure: ${layer.feature.properties.superstructure}<br>
Roofing: ${layer.feature.properties.roofing}<br>
Flooding: ${layer.feature.properties.flooded}<br>
Type of Damage: ${layer.feature.properties.type_of_damage}<br>
Water Intrusion: ${layer.feature.properties.water_intrusion}<br>
Est. Water Intrusion: ${layer.feature.properties.est_water_intrusion}<br>
Accessible: ${layer.feature.properties.accessible}<br>
Ext. Finish: ${layer.feature.properties.exterior_finish}<br>
Int. Finish: ${layer.feature.properties.interior_finish}<br>
Door/Windows: ${layer.feature.properties.doos_windows}<br>
Public URL: ${layer.feature.properties.public_url}<br>
`;
})
.addTo(map);
// console.log('Map updated');
}
// Initial call to update data
GetPDAGeoJSONData();
// Set interval to update data every minute (60000 milliseconds)
setInterval(GetPDAGeoJSONData, 30000);
//jQuery for the Filter button
// $('body').on("click", ".dropdown-menu", function (e) {
// $(this).parent().is(".open") && e.stopPropagation();
// });
// $('.selectall').click(function() {
// if ($(this).is(':checked')) {
// $('.option').prop('checked', true);
// var total = $('input[name="options[]"]:checked').length;
// $(".dropdown-text").html('(' + total + ') Selected');
// $(".select-text").html(' Deselect');
// } else {
// $('.option').prop('checked', false);
// $(".dropdown-text").html('Filter');
// $(".select-text").html(' Select');
// }
// });
// $("input[type='checkbox'].justone").change(function(){
// var a = $("input[type='checkbox'].justone");
// if(a.length == a.filter(":checked").length){
// $('.selectall').prop('checked', true);
// $(".select-text").html(' Deselect');
// }
// else {
// $('.selectall').prop('checked', false);
// $(".select-text").html(' Select');
// }
// var total = $('input[name="options[]"]:checked').length;
// $(".dropdown-text").html('(' + total + ') Filter Selected');
// });