Skip to content

Instantly share code, notes, and snippets.

@rpepato
Created August 9, 2011 12:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rpepato/1133925 to your computer and use it in GitHub Desktop.
Save rpepato/1133925 to your computer and use it in GitHub Desktop.
Add a simple map from Google Maps to a web application
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="http://maps.google.com/maps?file=api&v=28&key=xyz" type="text/javascript"> <!-- the required library for google maps usage -->
</script>
</head>
<body>
<div id="map" style="width: 500px; height:400px"></div>
<script type="text/javascript">
var map = new GMap2(document.getElementById("map")); <!-- must set the div where the map will render -->
map.setCenter(new GLatLng(39.754286, -104.994637), 16); <!-- Google uses 17 point scale. Level 0 is entire world - Level 17 is zoomed into the street level -->
map.addControl(new GLargeMapControl()); <!-- Add control to control zoom and pan -->
map.addControl(new GMapTypeControl()); <!-- Add control to change map view -->
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment