Skip to content

Commit 8977d36

Browse files
authored
test 1
1 parent 46dd452 commit 8977d36

3 files changed

Lines changed: 54 additions & 0 deletions

File tree

css/style.css

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
* Always set the map height explicitly to define the size of the div element
3+
* that contains the map.
4+
*/
5+
#map {
6+
height: 100%;
7+
}
8+
9+
/*
10+
* Optional: Makes the sample page fill the window.
11+
*/
12+
html,
13+
body {
14+
height: 100%;
15+
margin: 0;
16+
padding: 0;
17+
}

index.html

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<html>
2+
<head>
3+
<title>Data Layer: Simple</title>
4+
5+
<link rel="stylesheet" type="text/css" href="css/style.css" />
6+
<script type="module" src="js/script.js"></script>
7+
</head>
8+
<body>
9+
<div id="map"></div>
10+
11+
<!--
12+
The `defer` attribute causes the script to execute after the full HTML
13+
document has been parsed. For non-blocking uses, avoiding race conditions,
14+
and consistent behavior across browsers, consider loading using Promises. See
15+
https://developers.google.com/maps/documentation/javascript/load-maps-js-api
16+
for more information.
17+
-->
18+
<script
19+
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyB41DRUbKWJHPxaFjMAwdrzWzbVKartNGg&callback=initMap&v=weekly"
20+
defer
21+
></script>
22+
</body>
23+
</html>

js/script.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
let map;
2+
3+
function initMap() {
4+
map = new google.maps.Map(document.getElementById("map"), {
5+
zoom: 4,
6+
center: { lat: -28, lng: 137 },
7+
});
8+
// NOTE: This uses cross-domain XHR, and may not work on older browsers.
9+
map.data.loadGeoJson(
10+
"https://storage.googleapis.com/mapsdevsite/json/google.json",
11+
);
12+
}
13+
14+
window.initMap = initMap;

0 commit comments

Comments
 (0)