On Jul 24, 10:38 am, slindsey3000 <slindsey3...@gmail.com> wrote:
>
> Any cleanup suggestions?   Thanks!!
>
maybe create the map only once you know the geocode?

 function initialize() {

   geocoder = new google.maps.Geocoder();

   var address = "10 Downing St,London,UK";

   geocoder.geocode( { 'address': address}, function(results, status)
{
     if (status == google.maps.GeocoderStatus.OK) {

       map = new
google.maps.Map(document.getElementById("map_canvas"), {
         zoom: 12,
         center: results[0].geometry.location,
         mapTypeId: google.maps.MapTypeId.ROADMAP
       });

       var marker = new google.maps.Marker({
         map: map,
         position: results[0].geometry.location
       });

     } else {
       alert("Geocode was not successful for the following reason: " +
status);
     }
   });
 }

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to google-maps-js-api...@googlegroups.com.
To unsubscribe from this group, send email to 
google-maps-js-api-v3+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to