Return to Snippet

Revision: 57813
at June 11, 2012 08:27 by FatFolderDesigner


Initial Code
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!');
			}
		});
	}

Initial URL
http://fatfolderdesign.com/607/code/google-maps-api-2-the-second-post-multiple-locations-map-styling-and-the-new-geolocation

Initial Description
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 the link.

Initial Title
Google Maps API V3 Javascript Basic Example

Initial Tags
javascript, google

Initial Language
JavaScript