-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.html
76 lines (52 loc) · 2.31 KB
/
index.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<!DOCTYPE html>
<html lang="en">
<head>
<base target="_top">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Distrik Kota Jayapura</title>
<link rel="shortcut icon" type="image/x-icon" href="docs/images/favicon.ico" />
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=" crossorigin=""/>
<script src="https://unpkg.com/[email protected]/dist/leaflet.js" integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=" crossorigin=""></script>
<style>
.map {
height: 100vh;
width: 100%;
}
</style>
</head>
<body>
<div id='map' class="map"></div>
<script type="text/javascript" src="assets/geojson/jayapura.js"></script>
<script type="text/javascript">
const map = L.map('map');
map.createPane('labels');
map.getPane('labels').style.zIndex = 650;
map.getPane('labels').style.pointerEvents = 'none';
const cartodbAttribution = '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, © <a href="https://carto.com/attribution">CARTO</a>';
const positron = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: cartodbAttribution
}).addTo(map);
const positronLabels = L.tileLayer('http://{s}.basemaps.cartocdn.com/light_only_labels/{z}/{x}/{y}.png', {
attribution: cartodbAttribution,
pane: 'labels'
}).addTo(map);
const geojson = L.geoJson(distrik, {
style: function(feature) {
switch (feature.properties.nama) {
case 'Abepura': return {color: "#ff0000", fillColor: "#ff0000", fillOpacity: 1.0};
case 'Heram': return {color: "#0000ff", fillColor: "#0000ff", fillOpacity: 1.0};
case 'Jayapura Utara': return {color: "#00ff00", fillColor: "#00ff00", fillOpacity: 1.0};
case 'Jayapura Selatan': return {color: "#ffff00", fillColor: "#ffff00", fillOpacity: 1.0};
case 'Muara Tami': return {color: "#eed959", fillColor: "#eed959", fillOpacity: 1.0};
default: return {color: "#ffffff", fillColor: "#ffffff", fillOpacity: 1.0};
}
}
}).addTo(map);
geojson.eachLayer((layer) => {
layer.bindPopup(layer.feature.properties.nama);
});
map.setView({lat: -2.53371, lng: 140.71813}, 11);
</script>
</body>
</html>