Select to view content in your preferred language

Any property to hide data with a closing date ? TimeSlider

421
2
Jump to solution
01-24-2024 02:31 AM
JasonBOCQUET
Frequent Contributor

Hello Community,

 

I expose here what I want to do : I have data about societies and the major information that I  want to use is the Opening and Closing date of the society.

I'm working between 1950 and 2024 and some of societies was created (exemple 1973) and close few years later (exemple 2003); and some of other societies was created (exemple 1987) and actually still active (no close date).

I want to use the TimeSlide widget to show on my map my points when the timeline reach the Opening Date of the society but want to know if it's possible on my map to hide my points when the timeline reach the Closing Date of the society ? I don't know if any property exists to do something like that ?

 

I don't want to make all my points disappear from a certain date, I want each point to be hidden when their closing date is reached by the TimeSlider.

 

Anyone have an idea ?

0 Kudos
1 Solution

Accepted Solutions
UndralBatsukh
Esri Regular Contributor

Hi there, 

Do you have data with two date fields like opening and close dates? If so then you can filter your data based on the closing dates whenever timeSlider.timeExtent changes as shown below: 

timeSlider.watch("timeExtent", () => {
  const closedDate = timeSlider.timeExtent.start.getTime();
  const where = `perimeterdatetime = ${closedDate}`;
  layerView.filter = new FeatureFilter({ 
    where
  });
});


The following demo app shows how it can be done. Here is the live app:https://ubatsukh.github.io/arcgis-js-api-demos/devsummit2021/fire-perimeter/

Here is the code: https://github.com/ubatsukh/arcgis-js-api-demos/tree/master/devsummit2021/fire-perimeter

 

Hope this helps

View solution in original post

2 Replies
UndralBatsukh
Esri Regular Contributor

Hi there, 

Do you have data with two date fields like opening and close dates? If so then you can filter your data based on the closing dates whenever timeSlider.timeExtent changes as shown below: 

timeSlider.watch("timeExtent", () => {
  const closedDate = timeSlider.timeExtent.start.getTime();
  const where = `perimeterdatetime = ${closedDate}`;
  layerView.filter = new FeatureFilter({ 
    where
  });
});


The following demo app shows how it can be done. Here is the live app:https://ubatsukh.github.io/arcgis-js-api-demos/devsummit2021/fire-perimeter/

Here is the code: https://github.com/ubatsukh/arcgis-js-api-demos/tree/master/devsummit2021/fire-perimeter

 

Hope this helps

JasonBOCQUET
Frequent Contributor

Yes i have two different field; one for opening date and one for closing date.

 

thanks for your help; it's good for me 🙂

 

0 Kudos