/
inline.html
executable file
·61 lines (57 loc) · 1.7 KB
/
inline.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
<!DOCTYPE html>
<html>
<head>
<title>Maximum Zoom Imagery Service</title>
<script src="https://polyfill.io/v3/polyfill.min.js?features=default"></script>
<style type="text/css">
/* Always set the map height explicitly to define the size of the div
* element that contains the map. */
#map {
height: 100%;
}
/* Optional: Makes the sample page fill the window. */
html,
body {
height: 100%;
margin: 0;
padding: 0;
}
</style>
<script>
let map;
let maxZoomService;
let infoWindow;
function initMap() {
map = new google.maps.Map(document.getElementById("map"), {
zoom: 11,
center: { lat: 35.6894, lng: 139.692 },
mapTypeId: "hybrid",
});
infoWindow = new google.maps.InfoWindow();
maxZoomService = new google.maps.MaxZoomService();
map.addListener("click", showMaxZoom);
}
function showMaxZoom(e) {
maxZoomService.getMaxZoomAtLatLng(e.latLng, (result) => {
if (result.status !== "OK") {
infoWindow.setContent("Error in MaxZoomService");
} else {
infoWindow.setContent(
"The maximum zoom at this location is: " + result.zoom
);
}
infoWindow.setPosition(e.latLng);
infoWindow.open(map);
});
}
</script>
</head>
<body>
<div id="map"></div>
<!-- Async script executes immediately and must be after any DOM elements used in callback. -->
<script
src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap&libraries=&v=weekly"
async
></script>
</body>
</html>