Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>Earthquakes Map</title>
<style>
html, body, #map-canvas {
height: $($Height)px;
width: $($Width)px;
margin: 0px;
padding: 0px
}
</style>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<script>
function initialize() {
$Markers
var bounds = new google.maps.LatLngBounds();
var mapOptions = {
mapTypeId: google.maps.MapTypeId.HYBRID,
}
var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
for( i = 0; i < markers.length; i++ ) {
var position = new google.maps.LatLng(markers[i][1], markers[i][2]);
bounds.extend(position);
marker = new google.maps.Marker({
position: position,
map: map,
title: markers[i][0] + "\n" + markers[i][3] + "\nMagnitude: " + markers[i][4]
});
}
if (markers.length > 1) {
map.fitBounds(bounds);
}
else {
map.setCenter(new google.maps.LatLng(markers[0][1],markers[0][2]));
map.setZoom(4);
}
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="map-canvas"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment