Created
June 10, 2012 22:37
-
-
Save pgooch/2907561 to your computer and use it in GitHub Desktop.
Google Maps API V3 Javascript Basic
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This javascript will create a google map on the div with the ID "the_map" and centered on an address with | |
// a marker on it. In this example the address is for Jet City Improv. More information on setup and | |
// customization at: | |
// http://fatfolderdesign.com/607/code/google-maps-api-2-the-second-post-multiple-locations-map-styling-and-the-new-geolocation | |
window.onload = function(){ | |
var geocoder = new google.maps.Geocoder(); | |
geocoder.geocode({'address':'5510 University Way NE Seattle, WA 98105'},function(result,status){ | |
if(status==google.maps.GeocoderStatus.OK){ | |
var map = new google.maps.Map(document.getElementById("the_map"),{ | |
'center': result[0].geometry.location, | |
'zoom': 14, | |
'streetViewControl': false, | |
'mapTypeId': google.maps.MapTypeId.TERRAIN, | |
'noClear':true, | |
}); | |
new google.maps.Marker({ | |
'map': map, | |
'position': result[0].geometry.location, | |
}); | |
}else{ | |
alert('Address not found!'); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment