Clearing the queue after plotting the data

Hi

Have plotted a set of points on the map using the below code:

var allFeatures = [];

allFeatures.push({
type: “Feature”,
properties:{
“NAME”:“CC”,
“DESCRIPTION”:“This is a CC”,
“ICON”:“https://assets.onemap.sg/icons/youricon.gif
},
geometry:{
type: “Point”,
coordinates:[103.8,1.3]
}
});

var geojson = {type: “FeatureCollection”,features:allFeatures}

geojson.addTo(map);

Now ,I want to plot the map with another set of Points . In this case how do I clear the previous points on the map .

Thanks in advance

Adding more description to the above query : Firstly , a set of 5 (Latitude,Longitude) were plotted on the map. Below is the screen shot for the same:

Later another set of 5 points were plotted on the same map . So these 5 points just added up . Below is the screen shot for the same

So would like to check what is the API to clear the previously plotted data .

Awaiting a response

Hi ,

I could manage to clear the Plots/Markers with the below piece of code:

var layer = L.marker([1.3613875, 103.7497292], { icon: myIcon });
layer.addTo(map);
layer.remove();

Thanks

As our OneMap-Leaflet is based on the official LeafletJS which we have added OneMap functions on top of it. You can refer to the official LeafletJS documentation if you have any doubts.

Hi Kyroskoh

Noted with Thanks.

Thanks
Jeena