Skip to content

Instantly share code, notes, and snippets.

@pgooch
Created June 10, 2012 22:37
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 pgooch/2907561 to your computer and use it in GitHub Desktop.
Save pgooch/2907561 to your computer and use it in GitHub Desktop.
Google Maps API V3 Javascript Basic
// 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