-
Notifications
You must be signed in to change notification settings - Fork 0
/
map.php
84 lines (72 loc) · 2.18 KB
/
map.php
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
<html>
<head>
<title> OR7 GIS</title>
<script type="text/javascript" src="js/jquery-3.2.1.min.js"></script>
</head>
<body>
<h3>OR 7 GIS</h3>
<div id="container">
<div id="menu">
<a href="index.php" target="_blank">Cek GeoJson</a>
</div>
<div id="content">
<!-- <div style="width:50%; border-style: groove; float:left;"> -->
<div style="width:100%; height: 600px;" id="map"></div>
</div>
</div>
</div>
<div id="footer">
</div>
</div>
<script>
var map;
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
center: {lat: -0.9594256, lng: 123.7049278},
zoom: 5,
mapTypeId: 'roadmap'
});
var show_digitation ;
$.ajax({ url: 'index.php', dataType: 'json', cache: false, success: function(arrays){
for(i=0;i<arrays.features.length;i++){
var data = arrays.features[i];
var arrayGeometries = data.geometry.coordinates;
var p1 = '<p> Prov : '+data.properties.propinsi+'</p>';
var idTitik = 0;
var hitungTitik=[];
while(idTitik < arrayGeometries[0][0].length){
var aa = arrayGeometries[0][0][idTitik][0];
var bb = arrayGeometries[0][0][idTitik][1];
hitungTitik[idTitik]= {lat:bb,lng: aa};
idTitik += 1;
}
var warna = 'yellow';
show_digitation = new google.maps.Polygon({
paths: hitungTitik,
strokeColor: warna,
strokeOpacity: 1,
strokeWeight: 0.5,
fillColor: 'red',
fillOpacity: 0.35,
content: p1
});
show_digitation.setMap(map);
show_digitation.addListener('click', function(event) {
var lat = event.latLng.lat();
var lng = event.latLng.lng();
var info = {lat:lat, lng:lng};
infoWindow.setContent(this.content);
infoWindow.setPosition(info);
map.setCenter(info);
infoWindow.open(map);
});
}
}});
// Geolokasi / lokasi sendiri
var infoWindow = new google.maps.InfoWindow({map: map});
}
</script>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyANIx4N48kL_YEfp-fVeWmJ_3MSItIP8eI&callback=initMap"
async defer></script>
</body>
</html>