Filter data in layers by applying a time extent to a MapView.
Use case
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 frame. This can help to visualize changes in the data over time and aids in making better interpretations and predictions of future trends.
How to use the sample
Switch between the available options and observe how the data is filtered.
How it works
- Create a
MapView
with aMap
, and add layers that have time-enabled data. - Set the
TimeExtent
of the map view usingTimeExtent
property of the .
Relevant API
- Map
- MapView
- TimeExtent
Additional information
Note that time filtering is not applied until the MapView
is provided with a TimeExtent
. If the TimeExtent
is null
, no time filtering is applied and all content is rendered.
Tags
data, filter, time, time frame, time span
Sample Code
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage x:Class="ArcGISRuntime.Samples.ChangeTimeExtent.ChangeTimeExtent"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:esriUI="clr-namespace:Esri.ArcGISRuntime.Xamarin.Forms;assembly=Esri.ArcGISRuntime.Xamarin.Forms">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Label Grid.Row="0"
HorizontalTextAlignment="Center"
Text="Tap a year to filter the data." />
<Button Grid.Row="1"
Clicked="twoThousand_Clicked"
Text="2000" />
<Button Grid.Row="2"
Clicked="twoThousandFive_Clicked"
Text="2005" />
<esriUI:MapView x:Name="MyMapView" Grid.Row="3" />
</Grid>
</ContentPage>