-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcodingan.php
52 lines (41 loc) · 1.31 KB
/
codingan.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
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<div id="map_canvas" style="height: 600px; width: 800px"></div>
<script type="text/javascript">
var directionsDisplay;
var directionsService = new google.maps.DirectionsService();
var map;
function initialize() {
directionsDisplay = new google.maps.DirectionsRenderer();
//Mengambil koordinat utama
var latLng = new google.maps.LatLng(-6.183905,106.826838);
//Membuat map utama
var map = new google.maps.Map(document.getElementById('map_canvas'), {
zoom: 11,
center: latLng,
mapTypeControl: false,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
//Mendapatkan koordinat device yang sekarang
navigator.geolocation.getCurrentPosition(function(position) {
//Membuat variabel untuk posisi
var geolocate = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
//Mengambil gambar
//Membuat marker pada koordinat tersebut
var marker = new google.maps.Marker({
position: geolocate,
map: map,
animation:google.maps.Animation.BOUNCE,
title: "here"
});
});
}
</script>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBfPEyzhE27TUrMGysLGQDVvXzqldt56bw&callback=initialize"
async defer></script>
</body>
</html>