-
Notifications
You must be signed in to change notification settings - Fork 0
/
suggest.html
66 lines (60 loc) · 1.61 KB
/
suggest.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
<!DOCTYPE html>
<html>
<head>
<title>Place searches</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<style>
#map{height: 400px; width: 100%;}
html, body {
height: 100%;
margin: 0;
padding: 0;
}
</style>
<script>
var map;
var infowindow;
function initMap() {
var bellyBtn = {lat: 28.5494, lng: 77.2001};
map = new google.maps.Map(document.getElementById('map'), {
center: bellyBtn,
zoom: 15
});
infowindow = new google.maps.InfoWindow();
var service = new google.maps.places.PlacesService(map);
service.nearbySearch({
location: bellyBtn,
radius: 500,
type: ['school']
}, callback);
}
function callback(results, status) {
if (status === google.maps.places.PlacesServiceStatus.OK) {
for (var i = 0; i < results.length; i++) {
createMarker(results[i]);
}
}
}
function createMarker(place) {
var placeLoc = place.geometry.location;
//change color by changing blue to gree, red, yellow
var image = 'http://maps.google.com/mapfiles/ms/icons/blue-dot.png';
var marker = new google.maps.Marker({
map: map,
icon: image,
position: place.geometry.location
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.setContent(place.name);
infowindow.open(map, this);
});
}
</script>
</head>
<body>
<div id="map"></div>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDoMuTG-6-o5Sg1sV7TcB18y5nlMatdGn4&libraries=places&callback=initMap"
async defer></script>
</body>
</html>