Skip to content

Instantly share code, notes, and snippets.

@RalucaNicola
Created May 12, 2020 10:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RalucaNicola/e0da13acc73315b270ce6c1258345fd2 to your computer and use it in GitHub Desktop.
Save RalucaNicola/e0da13acc73315b270ce6c1258345fd2 to your computer and use it in GitHub Desktop.
const start = new Date(1900, 0, 1);
const end = new Date(2020, 0, 1);
const timeSlider = new TimeSlider({
container: "timeContainer",
mode: "cumulative-from-start",
fullTimeExtent: {
start: start,
end: end
},
values: [end],
stops: {
interval: {
value: 5,
unit: "years"
},
timeExtent: { start, end }
}
});
timeSlider.watch("timeExtent", function (timeExtent) {
const maxYear = timeExtent.end.getFullYear();
layer.definitionExpression = `yrbuilt <= ${maxYear}`;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment