Reputation: 159
I want to remove all markers from my mapbox
project. I didn't initialize marker on map via javascript
. It's from my mapbox project/api
. I just make marker on mapbox.com/projects
. I just try these but it didn't work. here is the screenshot of my project:
featureLayer.clearLayers();
L.mapbox.markerLayer().clearLayers();
markerLayer.clearLayers();
How can I remove all markers from my map.
Upvotes: 0
Views: 499
Reputation: 28678
Assuming you've initialized your L.mapbox.Map
with a project ID (Assuming, since you've shared completely no code in which we can see how you setup is) and thus the L.mapbox.featureLayer
is being created for you, you can get a reference to your featureLayer from your map instance like this:
var map = L.mapbox.map('map', 'your-project-id');
var featureLayer = map.featureLayer;
When you got a reference to your featureLayer you can use the clearLayers
method:
featureLayer.clearLayers();
// or in short without declaring a separate var:
map.featureLayer.clearLayers();
Upvotes: 1
Reputation: 162
I found this link for similar : Go through this option https://www.mapbox.com/help/remove-feature-editor/
Upvotes: 0