File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 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 >
Original file line number Diff line number Diff line change 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 ;
You can’t perform that action at this time.
0 commit comments