Time-aware layers

ArcGIS 10 includes support for time-aware layers, which 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:

When time-aware layers are present in an ArcGIS API for Windows Phone application, the map is considered time-aware and the map's time extent is set. The time extent defines the time period for which layers' data is displayed in the map. Setting the map's time extent is similar to setting the spatial extent because once the time extent is set the map display updates automatically to conform to the change. Every time the map's time extent is changed all time-aware layers update to reflect the new extent.

You can use the API to build applications that perform temporal queries, filter layers using time definitions, and set the map's time extent.

Making layers time-aware

You can make your layers time-aware using the Layer Properties dialog in ArcMap (right-click on the layer in ArcMap and choose Properties to display the dialog).

NoteNote:

The Time Field must be of type date.

Screen shot of enabling time on a layer.

The time information is preserved and accessible through a map service when you publish your map to ArcGIS Server. After publishing, you can work with a time-aware map or feature service using the ArcGISDynamicMapServiceLayer or FeatureLayer classes to perform temporal queries and view changes in data over time.

For image services time awareness is supported for mosaic datasets. Time information must be present in the attributes for the rasters that make up the mosaic dataset. To define time properties, use ArcMap or ArcCatalog and use the Default tab in the Properties dialog for the mosaic dataset (see below). After publishing, you can work with the ArcGISImageServiceLayer to leverage time aware content in your image service.

Screen shot of enabling time on a mosaic dataset.

Retrieving the TimeExtent of a time-aware layer

All time-aware layers have a TimeExtent property which provides access to the TimeExtent class. The TimeExtent class provides detailed information about the layer's time properties including the time range and time reference. The snippet below retrieves the time extent for a layer.

TimeExtent layerTimeExtent = (MyMap.Layers["MyFeatureLayer"] as FeatureLayer).TimeExtent;
NoteNote:

The above code assumes:

  • Your application has a reference to the ESRI.ArcGIS.Client assembly.
  • Your code-behind has a using statement for the ESRI.ArcGIS.Client namespace.
  • Your applications has a map named MyMap.
  • Your map has a time-aware layer named MyFeatureLayer.
  • MyFeatureLayer has been initialized. The TimeExtent property is not populated until after the layer has been initialized.

Creating dates and times to use with time-aware layers

When working with time-aware layers you may need to create dates and times in your Windows Phone application. The platform has a DateTime class to define a specific time and TimeSpan class to define a duration. Either can be used when creating a time extent to apply to a map or query a layer. When creating a new DateTime always specify Coordinated Universal Time (UTC) for the time zone. UTC is a time standard based on atomic time and is functionally equivalent to Greenwich Mean Time (GMT). UTC time is denoted by adding a 'Z' to the end of the time string. For example "2008-11-01T19:35:00.0000000Z" represents Saturday, 01 Nov 2008 19:35:00 UTC. If no time zone is specified then the ArcGIS Server REST API returns the date string without time zone information. If you use a date without a time zone in a temporal query the time zone may default to the current local time. This can result in dates that are off by several hours. The following example illustrates how to create a new TimeExtent instance and define a start time using a UTC date.

TimeExtent timeExtent = new ESRI.ArcGIS.Client.TimeExtent();
timeExtent.Start = DateTime.Parse("2010-01-29T17:33:46.0000000",
    System.Globalization.CultureInfo.CurrentCulture,
    System.Globalization.DateTimeStyles.AdjustToUniversal);

Filtering data using the Map's TimeExtent property

To visualize time-aware layers in your mapping applications use the TimeExtent property on the Map, which acts as a filter for time-aware layers. The TimeExtent property can be set on the Map after it loads. In this example, only data that falls within the input time extent definition of June 2, 2005, 0:00 UTC through June 2, 2010, 0:00 UTC appears.

private void MyMap_Loaded(object sender, RoutedEventArgs e)
{
    TimeExtent timeExtent = new ESRI.ArcGIS.Client.TimeExtent();
    timeExtent.Start = DateTime.Parse("2005-06-02T00:00:00.0000000Z",
        System.Globalization.CultureInfo.CurrentCulture,
        System.Globalization.DateTimeStyles.AdjustToUniversal);
    timeExtent.End = DateTime.Parse("2010-06-02T00:00:00.0000000Z",
        System.Globalization.CultureInfo.CurrentCulture,
        System.Globalization.DateTimeStyles.AdjustToUniversal); 
    MyMap.TimeExtent = timeExtent;
}

If instead you want to set the TimeExtent to a single instant in time, you can pass your desired DateTime into the TimeExtent constructor. In this example, only data from June 2, 2005, 0:00 UTC will appear on the map.

private void MyMap_Loaded(object sender, RoutedEventArgs e)
{
    TimeExtent timeExtent = new ESRI.ArcGIS.Client.TimeExtent(
        DateTime.Parse("2005-06-02T00:00:00.0000000Z",
            System.Globalization.CultureInfo.CurrentCulture,
            System.Globalization.DateTimeStyles.AdjustToUniversal));
    MyMap.TimeExtent = timeExtent;
}

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.


12/1/2010