-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGeoJSON.html
54 lines (49 loc) · 1.64 KB
/
GeoJSON.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
<!DOCTYPE html>
<html>
<head>
<title>Default Data Layer: Earthquakes</title>
<meta charset="UTF-8">
<meta name="viewport" content="initial-scale=1.0" />
<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>
</head>
<body id="map-container">
<div id="map"></div>
<script>
// [START script-body]
var map;
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
center: { lat: 20, lng: -160 },
zoom: 2
});
// Get the earthquake data (JSONP format)
// This feed is a copy from the USGS feed, you can find the originals here:
// http://earthquake.usgs.gov/earthquakes/feed/v1.0/geojson.php
var script = document.createElement('script');
script.setAttribute(
'src',
'https://storage.googleapis.com/mapsdevsite/json/quakes.geo.json');
document.getElementsByTagName('head')[0].appendChild(script);
}
// Defines the callback function referenced in the jsonp file.
function eqfeed_callback(data) {
map.data.addGeoJson(data);
}
// [END script-body]
</script>
<script async defer
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDRSwXzXpiCyiILELUd8_FdXBvVewBUIrU&callback=initMap"></script>
</body>
</html>