ESRI ArcGIS TimeSlider issue with multiple Feature Layers

4785
5
Jump to solution
10-28-2013 10:59 PM
Labels (1)
HumzaAkhtar
Occasional Contributor II
I am using ArcGIS API for WPF for my mapping application and my goal in this mapping application is to display time aware featurelayers and then use a TimeSlider (ESRI TimeSlider) to change the Time Extent of the layers. I am using the following two layers provided by ESRI.

http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/Since_1970/MapServer/0

http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Hurricanes/NOAA_Tracks_1851_2007/MapServe...


I am using ESRI TimeSlider as follows.

     <esri:TimeSlider x:Name="GTTimeSlider" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="5"                              TimeMode="TimeExtent"                             MinimumValue="{Binding LayerTimeExtentStart,Mode=TwoWay}"                              MaximumValue="{Binding LayerTimeExtentEnd,Mode=TwoWay}"                              Value="{Binding LayerTimeExtent,Mode=TwoWay}"                             Intervals="{Binding LayerTimeIntervals, Mode=OneTime}" BorderBrush="White"                    Background="{x:Null}" >

   
            </esri:TimeSlider>

The properties `LayerTimeExtent`, `LayerTimeExtentEnd` and `LayerTimeExtentStart` are set in the ViewModel for the `TimeSlider`. These values are initialized based on the TimeExtent of the feature layers which I mentioned above when they are added on the map. Using DataBinding I have bound these properties to the BaseMap using:

        Binding myBinding = new Binding("LayerTimeExtent");         myBinding.Source = this;         map.SetBinding(Map.TimeExtentProperty, myBinding);



The issue arises when I add both layers at the same time to the map. Although both layers initialize their own TimeSliders but changing the value of `TimeSlider` on one layer dialog box changes the `TimeExtent` value on the other layer as well as both are on the map at that moment and the map `TimeExtentProperty` is bound to the Value of `TimeSlider`. Is there a work around for this problem?

Here is a screenshot of the TimeSlider View along with the layers added on the basemap.

[ATTACH=CONFIG]28675[/ATTACH]
0 Kudos
1 Solution

Accepted Solutions
DavidLednik
Occasional Contributor II
Some one from ESRI development team already did 🙂

The sample show how you could overcome this.
It's not ideal because it was not intended to work this way so you basically need two map controls.
And put each layer in it's own map control. But you need to make sure the spatialreferences are the same otherwise
you'll get another headache trying to synchronize zoom and pan operations.

David

View solution in original post

0 Kudos
5 Replies
DavidLednik
Occasional Contributor II
I think this is by design. You can only bind one slider to maps TimeExtent property.

David
0 Kudos
HumzaAkhtar
Occasional Contributor II
I am also having the same feeling. However there must be a way to bypass this. Hope that some one from ESRI development team reply on this thread.
0 Kudos
DavidLednik
Occasional Contributor II
Some one from ESRI development team already did 🙂

The sample show how you could overcome this.
It's not ideal because it was not intended to work this way so you basically need two map controls.
And put each layer in it's own map control. But you need to make sure the spatialreferences are the same otherwise
you'll get another headache trying to synchronize zoom and pan operations.

David
0 Kudos
HumzaAkhtar
Occasional Contributor II
Thanks for the reply and the code. I think this is a way sure but I doubt that this solution will hit performance as the number of layers increase because of adding more and more invisible basemaps. However for small applications this can work.
Thanks
0 Kudos
DavidLednik
Occasional Contributor II
You're welcome 🙂

You could also take a look at QueryDataSource:
http://resources.arcgis.com/en/help/runtime-wpf/apiref/index.html?ESRI.ArcGIS.Client~ESRI.ArcGIS.Cli...

This way I think you could use single map and handle slider changes manually to refresh the particular layer/querydatasource

David
0 Kudos