Hello,

I do have lots of trouble with removing a marker. I use the code below
to set a marker on a specific country in Google Maps. The program
itself includes a big list of countries the user can choose one after
the other. The program then jumps to the country on Google maps and
sets the marker. As you probably all know it sets multiple markers. I
now try to find a way to change the below code in the way that after a
new marker will be set the one / all the ones before will be deleted.
So that there always is only one marker visible on the map. The
program will be a Google Chrome extension and therefore is not only
anymore.

Thanks a lot for your help in advance.

Cheers,
Thomas


function codeAddress()
{
        //get the country
        var address = country;

        if (geocoder) {
          geocoder.geocode( { 'address': address}, function(results, status)
{
                if (status == google.maps.GeocoderStatus.OK) {
                  map.setCenter(results[0].geometry.location);
                  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 API" group.
To post to this group, send email to google-maps-...@googlegroups.com.
To unsubscribe from this group, send email to 
google-maps-api+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-maps-api?hl=en.

Reply via email to