Page 1 of 1

Removing marker problem

Posted: Mon Aug 04, 2014 4:12 pm
by Vittorio Tiozzo

ello, I can't find out why this code doesn't work:
vHar map = new Appery('gmap2').gmap;

var markerLatLng = new google.maps.LatLng(localStorage.getItem("markerLat"), localStorage.getItem("markerLng"));
var Titolo = 'Some Title';

var gmarkerks = [];
var marker = new google.maps.Marker({
position: markerLatLng,
map: map,
title: Titolo,
animation: google.maps.Animation.DROP},
gmarkers.push(marker));

function setAllMap(map) {
for (var i = 0; i < gmarkers.length; i++) {
gmarkers.setMap(map);
}
}

function showMarkers() {
for (var i = 0; i < markers.length; i++) {
gmarkers.push(new google.maps.Marker(markers));

Code: Select all

 } 
 map.fitBounds(bounds); 
 setAllMap(map); 

}

google.maps.event.addListener(marker, 'click', function() {gmarkers.pop();
map.refresh();
setAllMap(map);
});

All that I want is to remove the last marker that the user has added to the page when the user clicks on a marker.
Thank you


Removing marker problem

Posted: Mon Aug 04, 2014 7:20 pm
by Evgene Karachevtsev

Vittorio,

Please look at this link, information there should be useful: https://developers.google.com/maps/do...


Removing marker problem

Posted: Wed Sep 02, 2015 2:02 pm
by Blair Cox

Vittorio - did you get this to actually work?? I only get...

Uncaught ReferenceError: setMapOnAll is not defined or setMapOnAll is not a function


Removing marker problem

Posted: Wed Sep 02, 2015 6:57 pm
by Blair Cox