What is a time-aware layer?

Time-aware layers store information about the changing state of a dataset over time. Time-aware layers allow you to step through periods of time, revealing patterns and trends in your data. For example, you can accomplish the following using time-aware layers:

All time-aware layers have a TimeExtent property that defines a time range, that is a start date and end date. There are also time field properties, those field(s) indicate at which time(s) the feature applies. Time-aware layers may have additional properties such as the time step interval (or tick) and the whether the data is cumulative or not. The time step interval indicates the frequency at which the data progression should be viewed, for example data can be viewed for each day or for each year.

All time-aware layers will display features for the time extent defined by the map. The TimeExtent property on time-aware layers cannot be set explicitly since it is defined by the map, feature, or image service. After publishing a map or feature service containing time-aware layers, you can work with either the ArcGISDynamicMapServiceLayer or ArcGISFeatureLayer class respectively to view changes in data over time.

Working with time-aware layers

You add time-aware ArcGISDynamicMapServiceLayer and/or ArcGISFeatureLayer 's to the map in exactly the same way as you would add those non time-aware layers to the map. The simplest way to work with time-aware layers is to use the TimeSlider control in the Toolkit because it handles the process of updating the map's time extent for you. Alternatively, you can use the API to build applications that perform temporal queries, filter layers using time definitions, and set the map's time extent.

Working with the toolkit's time slider

The ArcGIS Runtime SDK provides a TimeSlider control in the Toolkit library that simplifies the process of visualizing temporal data. Read How to use the time slider. Using the time slider, you can filter the map to display cumulative data up to a point in time, a single point in time, or data that falls within a time range. The benefits of using the time slider are that it filters time-aware layers to only display data for the current time extent and can play back changes over time.

You should not use the TimeSlider with feature layers in the "on demand" mode because it can result in too many requests to the server. If you're not working with a large amount of data, you can use an ArcGISFeatureLayer in snapshot mode. If your dataset is large, consider using an ArcGISDynamicMapServiceLayer instead.

Working with the API

When time-aware layers are present in a map the map's time extent must be set in order to visualize any of the data in the layers. The map's time extent defines the time period for which the layers' data is displayed in the map; so it acts as a filter for time-aware layers. Each time the map's time extent is changed, all time-aware layers update to reflect the new extent when the map is panned or zoomed.

In the following code example, the map's time extent is set, only data that meets the input time range appears:

JMap jMap = new JMap();
TimeExtent timeExtent = new TimeExtent(
																																							new GregorianCalendar(2009, 6, 2), new GregorianCalendar(2010,6, 30));

jMap.setTimeInterval(timeExtent); //the time interval can be set at any point in the life of the map

Disabling time-awareness for a layer means that all features from a layer, regardless of their time extent will be displayed. Disable time-awareness of a layer after the layer has initialized, as shown in the following code:

ArcGISDynamicMapServiceLayer layer = new ArcGISDynamicMapServiceLayer(
		"http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Hurricanes/NOAA_Tracks_1851_2007/MapServer");
layer.addLayerInitializeCompleteListener(new LayerInitializeCompleteListener() {		
			@Override
			public void layerInitializeComplete(LayerInitializeCompleteEvent arg0) {
				layer.getTimeOptions().get(0).getTimeOptions().setUseTime(false);
			}
		});
2/7/2013