TimeSilder heatmap

161
1
Jump to solution
08-11-2020 12:50 PM
BraulioCordova
New Contributor III

I have a layer that represents a heat map. When I run the filter with a timeslider, it doesn't work. Imagen(captura.png).

I think the problem lies in how the date is being captured, since in my table it is found as datetime type: YYYY-MM-DD.
I have tried to convert the captured date and I cannot find the solution yet. Please I need help.Robert Scheitlin, GISPArcGIS API for JavaScript

view.whenLayerView(layer).then(function(lv) {
layerView = lv;
const start = new Date(2020, 0, 1);
timeSlider.fullTimeExtent = {
start: start,
end: layer.timeInfo.fullTimeExtent.end
};

const end = new Date(start);
end.setDate(end.getDate() + 30);
timeSlider.values = [start, end];


});

timeSlider.watch("timeExtent", function() {
alert(timeSlider.timeExtent.end.getTime());
layer.definitionExpression ="time <= " + timeSlider.timeExtent.end.getTime();   // here I think it's a problem
layerView.effect = {
filter: {
timeExtent: timeSlider.timeExtent,
geometry: view.extent
},
excludedEffect: "grayscale(20%) opacity(12%)"
};
});

0 Kudos
1 Solution

Accepted Solutions
BraulioCordova
New Contributor III
solution
const timeSlider = new TimeSlider({
      container: "timeSlider",          
      mode: "time-window",
      view: mapView
    });
    timeSlider.layout = "compact";
    //mapView.ui.add(timeSlider, "bottom-left");  
    mapView.whenLayerView(layer).then(function(lv) {
      const fullTimeExtent = layer.timeInfo.fullTimeExtent;
      const start = fullTimeExtent.start;                
      const end = fullTimeExtent.end;                
      timeSlider.fullTimeExtent = {
                start: start,
                end: end
              };
      timeSlider.values = [new Date(202031),end];             
    });      
    timeSlider.watch("timeExtent"function() {
      layer.definitionExpression ="id_dist='"+ubigeo+"' and (time >= " +"'"+intl.formatDate(timeSlider.timeExtent.start.getTime(), intl.convertDateFormatToIntlOptions("short-date-short-time"))+"'"+" and time <= "+"'" +intl.formatDate(timeSlider.timeExtent.end.getTime(), intl.convertDateFormatToIntlOptions("short-date-short-time"))+"'"+")";
    });

View solution in original post

0 Kudos
1 Reply
BraulioCordova
New Contributor III
solution
const timeSlider = new TimeSlider({
      container: "timeSlider",          
      mode: "time-window",
      view: mapView
    });
    timeSlider.layout = "compact";
    //mapView.ui.add(timeSlider, "bottom-left");  
    mapView.whenLayerView(layer).then(function(lv) {
      const fullTimeExtent = layer.timeInfo.fullTimeExtent;
      const start = fullTimeExtent.start;                
      const end = fullTimeExtent.end;                
      timeSlider.fullTimeExtent = {
                start: start,
                end: end
              };
      timeSlider.values = [new Date(202031),end];             
    });      
    timeSlider.watch("timeExtent"function() {
      layer.definitionExpression ="id_dist='"+ubigeo+"' and (time >= " +"'"+intl.formatDate(timeSlider.timeExtent.start.getTime(), intl.convertDateFormatToIntlOptions("short-date-short-time"))+"'"+" and time <= "+"'" +intl.formatDate(timeSlider.timeExtent.end.getTime(), intl.convertDateFormatToIntlOptions("short-date-short-time"))+"'"+")";
    });

View solution in original post

0 Kudos