This repository was archived by the owner on Jun 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsumsum.js
More file actions
84 lines (81 loc) · 2.43 KB
/
sumsum.js
File metadata and controls
84 lines (81 loc) · 2.43 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
var map;
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
zoom: 8,
center: {lat: 2.3804, lng: 99.1438}
});
var geocoder = new google.maps.Geocoder();
// Load GeoJSON.
map.data.loadGeoJson('https://raw.githubusercontent.com/greenorb/greenorb.github.io/master/00.geojson');
// Set the stroke width, and fill color for each polygon
map.data.setStyle(function(feature) {
var Fungsi = feature.getProperty('Fungsi');
var color = "black";
if (Fungsi == "CA") {
color = "darkviolet";
}
if (Fungsi == "HL") {
color = "green";
}
if (Fungsi == "HP") {
color = "yellow";
}
if (Fungsi == "HPK") {
color = "deeppink";
}
if (Fungsi == "HPT") {
color = "lime";
}
if (Fungsi == "HSA") {
color = "darkviolet";
}
if (Fungsi == "SM") {
color = "darkviolet";
}
if (Fungsi == "Tahura") {
color = "darkviolet";
}
if (Fungsi == "TB") {
color = "darkviolet";
}
if (Fungsi == "TN") {
color = "darkviolet";
}
if (Fungsi == "TNL") {
color = "darkviolet";
}
if (Fungsi == "TWA") {
color = "darkviolet";
}
if (Fungsi == "TWAL") {
color = "darkviolet";
}
if (Fungsi == "KSA") {
color = "darkviolet";
}
if (Fungsi == "KSAL") {
color = "darkviolet";
}
return {
fillColor: color,
strokeWeight: 1
}
});
document.getElementById('submit').addEventListener('click', function() {
geocodeAddress(geocoder, map);
});
}
function geocodeAddress(geocoder, resultsMap) {
var address = document.getElementById('address').value;
geocoder.geocode({'address': address}, function(results, status) {
if (status === 'OK') {
resultsMap.setCenter(results[0].geometry.location);
var marker = new google.maps.Marker({
map: resultsMap,
position: results[0].geometry.location
});
} else {
alert('Gunakan satu spasi sebelum input lat/long: ' + status);
}
});
}