Select to view content in your preferred language

View all ArcGIS Server services layers in a treeview control(WPF)?

3693
18
06-07-2010 07:57 PM
linusang
Emerging Contributor
Hi,

My application requires to view all my server's services layers, preferably in a treeview control, and the user will then have the ability to choose which layers he wants to add onto the map.

My department has a number of categories in different subfolders. However, ArcGIS server does not allow subfolders creation to organize my department's mxd files.

i've briefly looked at the Table of Content sample. but realize it only show the TOC in mxd files when it is already added onto the map.

So how can i best implement this feature for my WPF ArcGIS app? Any examples or samples or guides would be very much appreciated.

thanks
0 Kudos
18 Replies
dotMorten_esri
Esri Notable Contributor
This is a completely unsupported workaround, and might VERY well break in the future, but if you go into the \Design\ folder below the assemblies, there is a .dll called ESRI.ArcGIS.Client.Design.Editors.dll.
This actually contains a service browser control for WPF (this is the one Blend and VS2010 is using when you browse for services in the URL property editor). However, given its nature and unsupportedness, don't expect any help on getting this to work 🙂
0 Kudos
linusang
Emerging Contributor
Hi

pardon me as i might misunderstood some concepts or your reply here....

what i want to achieve is if the mxd file that was published has a raster sub layer, is there a way i could add this raster layer on to the map? i could add a feature sub layer.. but how can i only add the raster sub layer? i need a conditional statement to know whether the sub layer is a feature layer before adding it?

I have uploaded the screenshot that actually provides the type if I click on the sublayer link in the REST pages... however, LayerInfo doesn't provide an attribute that describes the type...

0 Kudos
dotMorten_esri
Esri Notable Contributor
For raster layers you don't add a sublayer. Instead you add the entire mapservice to an ArcGISDynamicMapServiceLayer and set the VisibleLayers property to the ID of that sublayer (this actually goes for featurelayers as well if you want them rendered on the server).
0 Kudos
linusang
Emerging Contributor
Hi

thanks for clearing up.

however, i would like to create a FeatureLayer class for Feature type sublayer... how do i check if it is a feature sublayer?
0 Kudos
DominiqueBroux
Esri Frequent Contributor
This info is available with the REST API as well.
Example : http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/EarthquakesFromLastSevenDays/... returns:

{
  "id" : 0, 
  "name" : "Earthquakes from last 7 days", 
  "type" : "Feature Layer", 
  "description" : "Latest Earthquakes from the USGS CSV repository.\n\nhttp://earthquake.usgs.gov/earthquakes/catalogs/eqs7day-M1.txt  \n\nThe source network, ID, version, date, location, magnitude, depth (km) and number of reporting stations are in this layer.  This layer is updated every 5 minutes.", 
  "definitionExpression" : "", 
......


But we have to request by yourself the rest endpoint.
0 Kudos
linusang
Emerging Contributor
o... thanks.. i didn't know we could do that...

learnt something today... 😉
0 Kudos
linusang
Emerging Contributor
hi i encountered a problem...

i'm trying to deserialize the parent layer attribute.. i created a ParentLayerInfo contract class... but can't seems to do it...

for example the json shows this
"parentLayer" : {"id" : 2, "name" : "Water"}, 


i created a simple "ParentLayerInfo" class with 2 properties
[DataContract]
    public class ParentLayerInfo
    {
        [DataMember(Name="id")]
        public int ID { get; set; }
        [DataMember(Name = "name")]
        public string Name { get; set; }
    }


in my SubLayerInfo contract class

[DataContract]
    public class SubLayerInfo
    {
        //Properties
        ....
        ....
        [DataMember(Name = "parentLayer")]
        public ParentLayerInfo ParentLayer { get; set; }
        

    }


what might be wrong? if i omit the "parentLayer" DataMember completely... it deserializes fine...

thanks
0 Kudos
SergioGalindo
Deactivated User
Sample of a server explorer showing in a treeview a dynamic catalog of the ArcGIS Server map services : http://resources.esri.com/arcgisserver/apis/silverlight/index.cfm?fa=codeGalleryDetails&scriptID=162...

You can also test it live : http://maps.esri.com/serverexplorer/default.htm


Hi Dominique,

I realize it's been a while since your post, but I'm trying to do what you describe there; infortunately, the sample doesn't seem to be available anymore. Anyway I can find it or something similar?

Thanks in advance,

Sergio G
0 Kudos
DominiqueBroux
Esri Frequent Contributor
Hi Sergio,

I gave the old code in this thread : http://forums.arcgis.com/threads/52951-Server-explorer
0 Kudos