Posted By

FatFolderDesigner on 06/11/12


Tagged

javascript google example maps map


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

hurcy
Beppoi


Google Maps API V3 Javascript Basic Example


 / Published in: JavaScript
 

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

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.

  1. window.onload = function(){
  2. var geocoder = new google.maps.Geocoder();
  3. geocoder.geocode({'address':'5510 University Way NE Seattle, WA 98105'},function(result,status){
  4. if(status==google.maps.GeocoderStatus.OK){
  5. var map = new google.maps.Map(document.getElementById("the_map"),{
  6. 'center': result[0].geometry.location,
  7. 'zoom': 14,
  8. 'streetViewControl': false,
  9. 'mapTypeId': google.maps.MapTypeId.TERRAIN,
  10. 'noClear':true,
  11. });
  12. new google.maps.Marker({
  13. 'map': map,
  14. 'position': result[0].geometry.location,
  15. });
  16. }else{
  17. alert('Address not found!');
  18. }
  19. });
  20. }

Report this snippet  

You need to login to post a comment.