Skip to content

Instantly share code, notes, and snippets.

@bonza-labs
Created August 25, 2011 23:42
Show Gist options
  • Save bonza-labs/1172329 to your computer and use it in GitHub Desktop.
Save bonza-labs/1172329 to your computer and use it in GitHub Desktop.
Google maps API example showing Seattle traffic.
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
#map_canvas { height: 100% }
</style>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
function initialize() {
var center = new google.maps.LatLng(47.69,-122.25);
var myOptions = {
zoom: 11,
center: center,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
var trafficLayer = new google.maps.TrafficLayer();
trafficLayer.setMap(map);
}
</script>
</head>
<body onload="initialize()">
<div id="map_canvas" style="width:100%; height:100%"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment