ParisNakitaKejser
ParisNakitaKejser

Reputation: 14859

Reset all my markerLayer in Mapbox

i use Mapbox as a map to show company geoLoc on, my code is

var markerLayer = L.mapbox.markerLayer({
    type: 'Feature',
    geometry: {
    type: 'Point',
        coordinates: [value.GeoLng, value.GeoLat]
    },
    properties: {
        title: 'A Single Marker',
        description: 'Just one of me',
    }
}).addTo( $.mapbox.mapObj );

My problem is when i get a new json call and its return new locations did i don't know how i can reset/remove all my old markerLayer and its just add all the new to the map.

i have create a map obj. width jQuery as $.mapbox.mapObj so i hobe its posible to reset/remove all my markerLayers from my object and i soe can add all my new markerLayers on it.

Upvotes: 2

Views: 6346

Answers (1)

tmcw
tmcw

Reputation: 11882

You can reset marker layers with

markerLayer.clearLayers()

Upvotes: 3

Related Questions