time aware layer suppress time extent changed event

1314
5
Jump to solution
09-12-2016 10:01 AM
HasheenDeBerry
New Contributor III

Greetings Community!

Let me begin by saying that the following request is probably unlikely and definitely crazy, but I have been forced to ask anyway.  Here goes:

Is there a way via the Web APIs (JS in particular) to suppress the onTimeExtentChange event and ignore the time slider control for certain time-aware layers?  What I'm looking to achieve is for certain time-aware layers to always show the features in the latest time slice, regardless of the time slider thumb position.  For example, if my layer has features at 0300, 0600, 0900, and 1200, I would only like the time slider to display the features at 1200 for that layer regardless of the thumb position of the time slider.  

Any help you can provide is greatly appreciated.

Best,

HD

0 Kudos
1 Solution

Accepted Solutions
HasheenDeBerry
New Contributor III

Hello,

I believe I found a solution to the problem I was having.  I should also better describe what I was trying to achieve:

I wanted a way for a map service layer to only display data for a specified time extent, even if the layer had data outside of that time extent.  The FeatureLayer object does exactly that with something called a time definition. Now I can constrain a dense time-aware data set (think historical weather data) to only a small time frame, potentially improving performance of my maps.  Thanks to all who replied.

Best,

Hasheen

View solution in original post

0 Kudos
5 Replies
RickeyFight
MVP Regular Contributor

You want the layer to show both the current time and whatever the time slider is set to? 

0 Kudos
HasheenDeBerry
New Contributor III

Hi Rickey,

Thank you for your reply.  I can get the current time and thumb position on the slider.  What I'm looking for specifically is when a time-aware operational layer is on the map and the time slider is advancing, I would like that particular layer to only display the features that match the rightmost thumb position.  For example, if I have a radar layer on my map and the time slider is advancing the imagery west to east, I'd only like to display the feature(s) contained in the rightmost thumb position all the time, while other time-aware layers on that same map would display whatever features the current thumb position calls for.  I should also point out that I do not have access to the layer in question.  I'm essentially looking to do a temporal query on a time-aware layer that ignores the time slider's time-extent-change events.

I hope my explanation isn't as clear as mud.

Thanks again!

0 Kudos
StephanieWidas
New Contributor III

Hasheen,

How were you getting the current time and thumb position on the slider?  I'm trying to retrieve the current time shown on the map, but all I can find is how to set it not how to get it.

Thanks!

Stephanie

0 Kudos
HasheenDeBerry
New Contributor III

Hi Stephanie,

The TimeSlider class itself has a method you can call called

getCurrentTimeExtent()

which returns a TimeExtent object that has your beginning and ending date/time for the current time slice.  You can also subscribe to the time-extent-change event on the slider which passes the current time extent to your callback.  I do the latter in order to format the time displayed on my time slider to whatever my end user configures it to.  Some samples for that are here.

HTH,

Hasheen

HasheenDeBerry
New Contributor III

Hello,

I believe I found a solution to the problem I was having.  I should also better describe what I was trying to achieve:

I wanted a way for a map service layer to only display data for a specified time extent, even if the layer had data outside of that time extent.  The FeatureLayer object does exactly that with something called a time definition. Now I can constrain a dense time-aware data set (think historical weather data) to only a small time frame, potentially improving performance of my maps.  Thanks to all who replied.

Best,

Hasheen

0 Kudos