-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathq2.html
53 lines (47 loc) · 1.87 KB
/
q2.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
<!DOCTYPE html>
<html>
<head>
<title>Alberta Active Fires</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.3/leaflet.css" />
<style>
#mapid {
height: 600px;
}
</style>
</head>
<body>
<div id="mapid"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.3/leaflet.js"></script>
<script>
var map = L.map('mapid').setView([55, -113], 5);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: 'Map data © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors'
}).addTo(map);
fetch('https://cwfis.cfs.nrcan.gc.ca/geoserver/public/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=public:activefires_current&srsname=EPSG:4326&outputFormat=json')
.then(response => response.json())
.then(data => {
L.geoJSON(data.features, {
style: function (feature) {
var options = {
color: '#FF0000',
weight: 2,
fillOpacity: 0.5
}
return options;
},
onEachFeature: function (feature, layer) {
var popupContent = "<p>"
+ "Size: " + feature.properties.hectares + "<br/>"
+ "</p>";
layer.bindPopup(popupContent);
},
pointToLayer: function (feature, latlng) {
return L.circleMarker(latlng);
}
}).addTo(map);
});
</script>
</body>
</html>