Remove marker MapquestGL Map

2 posts / 0 new
Last post
atiqsayyed
Remove marker MapquestGL Map

Hi,

I'm creating a marker on map simply using MapQuestGL library 

var map = new mqgl.Map('map', 'KEY', {
center: [-43.698637,42.300916],
zoom: 18,
bearing: 0,
pitch: 0,
style:"hybrid"
});

locations.forEach(function (feature, index) {

  var lat = feature.lat

  var lon = feature.lon

  map.icons.marker.addWithPopup({ lng: long, lat: lat }, iconName, propHtml);

})

Is there a way to clear all markers from the MAP??

Now I want to delete all the markers on the Map, I'm not able to find a way to do this, can anyone help me here??

 


phonefashion
Marker remove

You can clear the map before you put new markers using

map.getController().clear()

it will clear everything on map.

if you want to remove Marker only then you have to create Marker object when you add the marker on map

Marker some_Marker = map.getController().addMarker(new MarkerOptions().icon(marker_icon).position(coordinates);

And Remove Marker

map.getgetController().removeMarker(some_Marker)