Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
- <title>Google Maps API Demo</title>
- <script src="http://maps.google.com/maps?file=api&v=2&sensor=false"
- type="text/javascript"></script>
- </head>
- <body onunload="GUnload()">
- <div id="map_canvas" style="width: 400px; height: 300px"></div>
- <script type="text/javascript">
- var yourAddress = '1 Infinite Loop Cupertino CA 95014, USA';
- if (GBrowserIsCompatible()) {
- var geocoder = new GClientGeocoder();
- geocoder.getLocations(yourAddress, function (locations) {
- if (locations.Placemark)
- {
- var north = locations.Placemark[0].ExtendedData.LatLonBox.north;
- var south = locations.Placemark[0].ExtendedData.LatLonBox.south;
- var east = locations.Placemark[0].ExtendedData.LatLonBox.east;
- var west = locations.Placemark[0].ExtendedData.LatLonBox.west;
- var bounds = new GLatLngBounds(new GLatLng(south, west),
- new GLatLng(north, east));
- var map = new GMap2(document.getElementById("map_canvas"));
- map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds));
- }
- });
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment