title: Display a subset of geojson data selected by a slider as a group on a leaflet map
body: <p>I'm working on visualizing a medium sized (6000 pts) spatial data set that has 48 subsets each consisting of 125 points. I'm using Leaflet, I have the data in a GeoJSON, and I'm using <a href="https://github.com/dwilhelm89/LeafletSlider/blob/master/SliderControl.js" rel="nofollow">LeafletSlider</a> for the slider. </p>
  
  <p>I'm running into one problem, which is that the data is added incrementally, rather than as subsets. In other words, while incrementing through the values using the slider, I want each step to remove the previous 125 points and add the next 125. </p>
  
  <p>Here is the code for the slider from Dennis Wilhelm's <a href="https://github.com/dwilhelm89/LeafletSlider/blob/master/SliderControl.js" rel="nofollow">LeafletSlider</a> that I am using:</p>
  
  <pre><code>startSlider: function () {
          options = this.options;
          $("#leaflet-slider").slider({
              value: options.minValue + 1,
              min: options.minValue,
              max: options.maxValue +1,
              step: 1,
              slide: function (e, ui) {
                  if(!!options.markers[ui.value]) {
                  if(options.markers[ui.value]) $('#slider-timestamp').html(options.markers[ui.value].feature.properties.time.substr(0, 16));
  
                  for (var i = options.minValue; i &lt; ui.value ; i++) {
                      if(options.markers[i]) map.addLayer(options.markers[i]);
                  }
                  for (var i = ui.value; i &lt;= options.maxValue; i++) {
                      if(options.markers[i]) map.removeLayer(options.markers[i]);
                  }
              }
          }
      });
      map.addLayer(options.markers[options.minValue]);
  }
  </code></pre>
  
  <p>I am not sure how to modify this so as to achieve this functionality. Do I first group each of the points that meets the <code>ui.value</code> criteria into a LayerGroup and then add? If so, I'm not really sure how to modify this code to achieve that? How do I make sure that the previous layer group is removed? Should I be doing this subsetting in the geojson file that I pass into to speed this us, or is it acceptable to subset on the client side like this?</p>
  
  <p>Thanks in advance.</p>