Can a feature layer with a feature collection be time-aware?

596
1
Jump to solution
01-07-2014 12:29 PM
TyroneLigon
Occasional Contributor
As usual, apologies up front because I can't post my code from our intranet...I create a feature layer by creating graphics based on info coming from our server. Here's the flow:


  • start and end times are determined by cycling through the data

  • the layer is declared with a mode of SNAPSHOT

  • the layer is added to the map

  • a graphics array is added to the layer using applyEdits

  • a time extent is created using the start and end times

  • the map's time extent is set using the time extent

  • I have tried applying the time extent to the layer, but I get a console message stating that feature collection layers do not support definition expressions or time definitions

  • the time slider's time stops are set from the time extent

  • the time slider has a single thumb

  • the time slider is started

At this point all the data loaded into the feature layer is displayed. Changes to the time slider have no effect on the feature layer. Hoping that I've missed something, because the only thing not working in this entire process of integrating the time slider is the temporal filtering of the layer's data.
0 Kudos
1 Solution

Accepted Solutions
TyroneLigon
Occasional Contributor
Problem solved - the date field contained a string that the map couldn't interpret as a date. I created an additional date field, then I created an additional attribute in each graphic containing an actual date object. I also changed the workflow based on the time slider samples and feature layer samples:


  • create a feature layer

  • add a listener to the map's 'layers-add-result' event to init the time slider

  • add the feature layer along with other graphics layers to the map

  • configure the time slider

  • when data arrives from the server, create an array of graphics; determine if the data load has a time extent

  • if there's a time extent, create a time extent object and add the graphics to the feature layer using the 'applyEdits' method

  • set/change the time slider's ticks by applying the time extent

  • start the time slider

  • set the map's time extent to the time extent object

View solution in original post

0 Kudos
1 Reply
TyroneLigon
Occasional Contributor
Problem solved - the date field contained a string that the map couldn't interpret as a date. I created an additional date field, then I created an additional attribute in each graphic containing an actual date object. I also changed the workflow based on the time slider samples and feature layer samples:


  • create a feature layer

  • add a listener to the map's 'layers-add-result' event to init the time slider

  • add the feature layer along with other graphics layers to the map

  • configure the time slider

  • when data arrives from the server, create an array of graphics; determine if the data load has a time extent

  • if there's a time extent, create a time extent object and add the graphics to the feature layer using the 'applyEdits' method

  • set/change the time slider's ticks by applying the time extent

  • start the time slider

  • set the map's time extent to the time extent object

0 Kudos