Time and FeatureLayers

769
3
01-07-2011 03:36 AM
MR
by
New Contributor
Hi,

I am using a FeatureLayer to map points stored in a SQL Database. When I edit my service to enable Time on the layer the FeatureLayer stops showing anything. I thought perhaps I needed to set a TimeExtent but still nothing.

What do I need to do to get my FeatureLayer working again now that I have enabled Time on the service?

var featureLayer = new esri.layers.FeatureLayer(http://intranet/ArcGIS/rest/services/LORD/MYSERVICE/MapServer/0",{
                mode: esri.layers.FeatureLayer.MODE_SNAPSHOT,
                outFields: ["NUMBER, GRID_TYPE"]
});
 
var timeExtent = new esri.TimeExtent();
timeExtent.startTime = new Date("1/1/1999 UTC");
timeExtent.endTime = new Date("12/31/2020 UTC");
featureLayer.setTimeDefinition(timeExtent);
 
map.addLayer(featureLayer);

Many thanks,

Mark
0 Kudos
3 Replies
EricKabuchanga
New Contributor
Hi,

I am using a FeatureLayer to map points stored in a SQL Database. When I edit my service to enable Time on the layer the FeatureLayer stops showing anything. I thought perhaps I needed to set a TimeExtent but still nothing.

What do I need to do to get my FeatureLayer working again now that I have enabled Time on the service?

var featureLayer = new esri.layers.FeatureLayer(http://intranet/ArcGIS/rest/services/LORD/MYSERVICE/MapServer/0",{
                mode: esri.layers.FeatureLayer.MODE_SNAPSHOT,
                outFields: ["NUMBER, GRID_TYPE"]
});
 
var timeExtent = new esri.TimeExtent();
timeExtent.startTime = new Date("1/1/1999 UTC");
timeExtent.endTime = new Date("12/31/2020 UTC");
featureLayer.setTimeDefinition(timeExtent);
 
map.addLayer(featureLayer);

Many thanks,

Mark
o


Hi Mark,

I am having the same problem. Though i haven't setup a time enable service but i tend to think the cause may be you need to have regular Time Step Intervals between each feature. if your data has irregular time intervals then you will not see anying on the layer.

This is why am asking if anyone knows how to deal with irregular time step intervals.
0 Kudos
KellyHutchins
Esri Frequent Contributor
Mark - I took a look at your code on the other thread and it looks fine and works with sample service time enabled layers. If you view your service in the services directory and click the JavaScript link does the service display?
0 Kudos
MR
by
New Contributor
Well yes, it works fine then - but that uses ArcGISDynamicMapServiceLayer rather than a FeatureLayer.
0 Kudos