Sunday 27 August 2017

c# - How do I exclude raster layers from legend? (Silverlight, ArcGIS Server)


I'm trying to adjust my Print Widget so that raster layers do not show up in the legend. My thinking was that I could test for a layer type and not add the item to the legend if it is a raster.


Something like:


Foreach (layer in List)
If layer is a raster:
do nothing;
Else:
Add it to the legend;


I know there's a LayerInfo thing out there but I'm not really sure how to use it. Incidentally, I'm new to C#/Silverlight/ArcGIS for Server so this simple task is a bit challenging for me. I did notice there was a GetType() method(?) that I might be able to use but I'm not sure if how if that is indeed the answer. The foreach legend item code already exists and such -- I'm looking to wrap some conditions around the legendItems.Add bit. I found the following resources, but not sure how to use them if they are helpful... http://help.arcgis.com/en/webapi/sil...o_members.html --> the "Type" property, perhaps?


Alternatively, if I'm going about this in a difficult/wrong way, feel free to point that out! I'm a new intern with no prior C#/ArcGIS Server/Silverlight experience so it's all a bit overwhelming.


Thanks in advance!


Thread on arcgis forums: http://forums.arcgis.com/threads/83788-How-do-I-retrieve-layer-type


additional thoughts: -- I'll somehow have to create a list of all the layers, too >_<.




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...