forked from BryceStPierre/google-maps-api-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
37 lines (31 loc) · 889 Bytes
/
Copy pathscript.js
File metadata and controls
37 lines (31 loc) · 889 Bytes
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
var map;
function createMap () {
var options = {
center: { lat: 0, lng: 130 },
mapTypeId: 'terrain',
zoom: 2
};
map = new google.maps.Map(document.getElementById('map'), options);
var script = document.createElement('script');
script.src = 'https://developers.google.com/maps/documentation/javascript/examples/json/earthquake_GeoJSONP.js';
document.getElementsByTagName('head')[0].appendChild(script);
map.data.setStyle(function(feature) {
var magnitude = feature.getProperty('mag');
return {
icon: getEarthquakeCircle(magnitude)
};
});
}
function getEarthquakeCircle (value) {
return {
path: google.maps.SymbolPath.CIRCLE,
fillColor: 'purple',
fillOpacity: .2,
scale: Math.pow(2, value) / 2,
strokeColor: 'white',
strokeWeight: .5
};
}
function eqfeed_callback (geojson) {
map.data.addGeoJson(geojson);
}