使用 LeafletSlider 隐藏标记?

Hiding markers using LeafletSlider?

我正在使用 LeafletSlider plugin. The camps appear on the map based on an attribute in my GEOJSON object called DATE_START. As you can see in my JSFIDDLE 在我的地图上显示难民营的时间范围,滑块效果很好。

当我清理时间线时,我想删除具有 DATE_CLOSED 属性 的标记,具体取决于当前时间线清理的日期和 DATE_CLOSED 的日期属性。

看来这个时间滑块插件只显示标记。有谁知道日期结束后如何隐藏标记?

Sample data:

var camps = {"type":"FeatureCollection","features":[{"type":"Feature","properties":{"STATUS":"UNOCCUPIED","DATE_START":"2015-06-23","DATE_CLOSED":"2016-01-23"},"geometry":{"type":"Point","coordinates":[64.6875,34.97600151317591]}},{"type":"Feature","properties":{"STATUS":"OCCUPIED","DATE_START":"2014-01-21","DATE_CLOSED":"2015-05-25"},"geometry":{"type":"Point","coordinates":[65.335693359375,36.26199220445664]}},{"type":"Feature","properties":{"STATUS":"UNOCCUPIED","DATE_START":"2015-09-13","DATE_CLOSED":""},"geometry":{"type":"Point","coordinates":[67.587890625,35.969115075774845]}}]};

Code:

var map = L.map('map', {
center: [33.67406853374198, 66.9287109375],
zoom: 7
}).addLayer(new L.TileLayer("http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"));


//Create a marker layer (in the example done via a GeoJSON FeatureCollection)
var testlayer = L.geoJson(camps, {
onEachFeature: function(feature, layer) {
    layer.bindPopup(feature.properties.DATE_START);
    }
});

var sliderControl = L.control.sliderControl({
position: "topright",
layer: testlayer,
timeAttribute: 'DATE_START'
});

//Make sure to add the slider to the map ;-)
map.addControl(sliderControl);

sliderControl.options.markers.sort(function(a, b) {
return (a.feature.properties.DATE_START > b.feature.properties.DATE_START);
});

//And initialize the slider
sliderControl.startSlider();

$('#slider-timestamp').html(options.markers[ui.value].feature.properties.DATE_START.substr(0, 10));

我希望这算作一个答案,但我发现有一个替代时间轴插件可以满足我的需要:https://github.com/skeate/Leaflet.timeline