-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex2.html
More file actions
112 lines (86 loc) · 3.85 KB
/
index2.html
File metadata and controls
112 lines (86 loc) · 3.85 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<!DOCTYPE html>
<html>
<head>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<style>
#map {
height: 400px;
width: 800px;
margin: 20px auto;
}
.works {
width: 800px;
margin: 20px auto;
}
</style>
</head>
<body>
<div id="map"></div>
<div class="works">
<div class="row">
<div class="col-xs-6">
<div class="input-group"> <span class="input-group-addon">Latitude</span> <input class="form-control" placeholder="Latitude value" id="Latitude"> </div>
</div>
<div class="col-xs-6">
<div class="input-group"> <span class="input-group-addon">Longitude</span> <input class="form-control" placeholder="Longitude value" id="Longitude"> </div>
</div>
</div>
<br>
<div class="well text-center"></div>
</div>
<script>
var marker = null;
var LatInput = document.getElementById("Latitude");
var LngInput = document.getElementById("Longitude");
var mapContainer = document.querySelector(".well");
if (mapContainer.innerHTML.length == 0) {
mapContainer.style.display = "none"
}
function initMap() {
var istanbul = {
lat: 41.068480,
lng: 29.019699
};
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 10,
center: istanbul
});
map.addListener('click', function(e) {
placeMarker(e.latLng, map);
posbil(e.latLng);
//map.setCenter(e.latLng);
mapContainer.innerHTML = '<iframe width="760" height="400" frameborder="0" style="border:0" src="https://www.google.com/maps/embed/v1/place?q=' + e.latLng.lat() + ',' + e.latLng.lng() + '&key=AIzaSyD3jvLuCOq7tB6ulw941CQDKduU9Rhdom4&zoom=16" allowfullscreen></iframe>';
mapContainer.style.display = "block";
});
}
function placeMarker(latLng, map) {
if (marker == null) {
marker = new google.maps.Marker({
position: latLng,
map: map,
draggable: true
});
google.maps.event.addListener(marker, 'click', function() {
marker.setMap(null);
});
google.maps.event.addListener(marker, 'drag', function(e) {
posbil(e.latLng);
});
} else {
if (marker.getMap() == null) {
marker.setMap(map);
}
marker.setPosition(latLng);
}
}
function posbil(latLng) {
LatInput.value = latLng.lat().toFixed(6);
LngInput.value = latLng.lng().toFixed(6);
}
</script>
<script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyD3jvLuCOq7tB6ulw941CQDKduU9Rhdom4&callback=initMap"></script>
</body>
</html>