Guest User

Untitled

a guest
Nov 10th, 2012
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
  5. <title>Google Maps API Demo</title>
  6. <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=false"
  7. type="text/javascript"></script>
  8. </head>
  9. <body onunload="GUnload()">
  10.  
  11. <div id="map_canvas" style="width: 400px; height: 300px"></div>
  12.  
  13. <script type="text/javascript">
  14.  
  15. var yourAddress = '1 Infinite Loop Cupertino CA 95014, USA';
  16.  
  17. if (GBrowserIsCompatible()) {
  18. var geocoder = new GClientGeocoder();
  19. geocoder.getLocations(yourAddress, function (locations) {
  20. if (locations.Placemark)
  21. {
  22. var north = locations.Placemark[0].ExtendedData.LatLonBox.north;
  23. var south = locations.Placemark[0].ExtendedData.LatLonBox.south;
  24. var east = locations.Placemark[0].ExtendedData.LatLonBox.east;
  25. var west = locations.Placemark[0].ExtendedData.LatLonBox.west;
  26.  
  27. var bounds = new GLatLngBounds(new GLatLng(south, west),
  28. new GLatLng(north, east));
  29.  
  30. var map = new GMap2(document.getElementById("map_canvas"));
  31.  
  32. map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds));
  33. }
  34. });
  35. }
  36. </script>
  37. </body>
  38. </html>
Advertisement
Add Comment
Please, Sign In to add comment