start date and end date is not work with geojson data
I read README and I used the form "String formed by start date/end date/period " But It isn't work! How do I make the features have their own period? (Ex. One feature show up at 2015-08-01 and hide at 2016-08-02, and another feature show up and hide not the same period! )
My code :
{ "id": "0", "type": "Feature", "properties": { "nuts_id": "ES", "levl_code": 0, "cntr_code": "ES", "nuts_name": "ESPAÑA", "fid": "ES", "name": "ESPAÑA", "value": 279.1763000488281, "times": "2015-08-01/2016-08-02/P1D" //--->Not Work! },
This is only for timeDimension itself.
Features on geoJSON only support time or times array : https://github.com/socib/Leaflet.TimeDimension#ltimedimensionlayergeojson
You can change this behavior by overriding _getFeatureTimes or _getFeatureBetweenDates on a geoJSON layer subclass.
Change _getFeatureTimes to return an array of time based on the period parsing.
see Example 15
L.TimeDimension.Layer.GeoJsonWithPeriod = L.TimeDimension.Layer.GeoJson.extend({
_getFeatureTimes: function(feature) {
if (!feature.properties) {
return [];
}
if (feature.properties.hasOwnProperty('times')) {
return L.TimeDimension.Util.parseTimesExpression(feature.properties.times);
}
return [];
}
})
Something like that.