Select to view content in your preferred language

Prevent rendering of a layer until time definition is applied

3883
1
01-27-2015 08:51 AM
StephenGregory
Deactivated User

I want to add layers to a map, with some criteria. Before the layer is drawn, I want to a set a time definition on the client-side to limit the data being rendered.

I've tried setting the time definition prior to calling map.addLayer, but the API seems to ignore the time definition when the layer is added to the map.

So briefly:

  1. FeatureLayer object created (in SNAPSHOT mode)
  2. setTimeDefinition called for FeatureLayer
  3. FeatureLayer object added to map via addLayer.

When 3 happens, a request is sent to the service but the time definition is not sent in the request.

${service url}/query?f=json&where=1%3D1&returnGeometry=true&spatialRel=esriSpatialRelIntersects&outFields=*&outSR=102100

as opposed to

${service url}/query?f=json&where=1%3D1&returnGeometry=true&spatialRel=esriSpatialRelIntersects&outFields=*&outSR=102100&time=1422030483999%2C1422030484000

Thoughts on what is happening? Is there another ordering I should try?

0 Kudos
1 Reply
KellyHutchins
Esri Frequent Contributor

I ran a quick test using some sample data and in my testing the time extent was applied to the layer query. Here's my test app.

Create a Map

Maybe try this test app with your data and see if it works?

0 Kudos