Getting Time Extent info from sub layers...

631
3
10-05-2011 11:41 AM
VincenzoPiscitelli
New Contributor
I am publishing a map service which contains 6 sub layers, 2 of which are time aware.  I load the layer using an ArcGISDynamicMapServiceLayer which points to the /MapServer endpoint.

The user has the option of turning on individual sub layers.  All are off by default.

1) I need to show the time slider if the selected sub layer is time aware (hide the slider if not)
2) I need to configure the time intervals based on the data published by the layer.

How do I retrieve time extent information for sub layers of an ArcGISDynamicMapServiceLayer??

Thanks in advance.

Enzo
0 Kudos
3 Replies
JenniferNery
Esri Regular Contributor
In the upcoming release we will be including GetDetails and GetAllDetails to retrieve more information on the sub layers.

For the time-being, you can create a FeatureLayer with URL: ArcGISDynamicMapService.Url + Layer.ID. You will have this metadata when the layer is initialized.

  FeatureLayer l = new FeatureLayer()
            {
                Url = string.Format("{0}/{1}", ArcGISDynamicMapService.Url,  Layer.ID)
            };
            l.Initialized += (s, e) =>
                {
                    var layerInfo = l.LayerInfo;
                    var timeExtent = l.TimeExtent;
                };
            l.Initialize();
0 Kudos
VincenzoPiscitelli
New Contributor
Thank you for your quick response.

Is there a performance gain/loss using your way versus simply calling the layers JSON enpoint directly?

For example...using Url = string.Format("{0}/{1}?f=json", ArcGISDynamicMapService.Url,  Layer.ID) and then using the using System.Json Namespace to parse it.

I came up with this solution while waiting for your response. 😉
0 Kudos
JenniferNery
Esri Regular Contributor
No problem. Your solution works too and maybe best if you only need to parse few properties. It is also available in the API if you don't want to write the extra code 🙂
0 Kudos