-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathleaf1.html
53 lines (45 loc) · 1.57 KB
/
leaf1.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>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css">
<script src="https://unpkg.com/[email protected]/dist/leaflet-src.js"></script>
<script src='//api.tiles.mapbox.com/mapbox.js/plugins/leaflet-omnivore/v0.3.1/leaflet-omnivore.min.js'></script>
<style>
html, body {
height: 100%;
}
#map {
height: 75%;
}
</style>
</head>
<body>
<div id="map"></div>
<script>
var map = L.map("map").setView([48.85, 2.35], 12);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
var runLayer = omnivore.kml('GOOGLE_SOUTHEAST_ASIA_rain_accumulation_72hr.kml').addTo(map).on('ready', function () {
map.fitBounds(runLayer.getBounds());
console.log(runLayer.toGeoJSON());
runLayer.eachLayer(function (layer) {
if (layer.feature.properties.styleUrl === '#PolyStyleOGreen') {
if (layer.feature.geometry.type === 'LineString') {
// See Leaflet path layers options
// http://leafletjs.com/reference-1.0.3.html#path
layer.setStyle({
color: '#ff6e6e6e', // More red than green and blue => redish color
weight: 4
});
} else {
console.log('unknown geometry type');
}
} else {
console.log('unknown styleUrl');
}
});
});
</script>
</body>
</html>