Filter by time extent
The time slider provides controls that allow you to visualize temporal data by applying a specific time extent to a map view.
When viewing feature layers that contain a large amount of data with timestamps, you may want to filter the data to only show data relevant to a specific time range. This can help visualize changes in the data over time and aids in making better interpretations and predictions of future trends.
Use the slider at the bottom of the map to customize the date range for which you want to view the data. The date for the hurricanes sample data ranges from September 1st, 2005 to December 31st, 2005. Once the start and end dates have been selected, the map view will update to only show the relevant data that falls in the time extent selected. Use the play button to step through the data one day at a time. Use the previous and next buttons to go back and forth in 2 day increments as demonstrated below.
- Create a
Map, and add layers that have time-enabled data.
- Create a
TimeSliderfrom the ArcGIS Runtime Toolkit to allow users to show data only from the given date range.
TimeSlider.InitializeTimePropertiesAsyncto initialize the full extent and time intervals of the
TimeSliderbased on the time-aware
- Create a
TimeSlider.CurrentExtentChangedevent handler to update the
This sample uses Atlantic hurricane data from the National Hurricane Center (NOAA / National Weather Service) and the
TimeSlider toolkit component which requires the toolkit to be cloned and set up locally. For information about setting up the toolkit, see the repository's root README.md here.
animate, data, filter, time, time extent, time frame, toolkit
<UserControl x:Class="ArcGISRuntime.WPF.Samples.FilterByTimeExtent.FilterByTimeExtent" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="*" /> <RowDefinition Height="auto" /> </Grid.RowDefinitions> <esri:MapView x:Name="MyMapView" Grid.Row="0" /> <esri:TimeSlider x:Name="MyTimeSlider" Grid.Row="1" MaxWidth="800" Margin="0,20" CurrentExtentChanged="TimeSlider_CurrentExtentChanged" /> </Grid> </UserControl>