Select to view content in your preferred language

Sublayer Question

2988
4
Jump to solution
06-09-2012 07:07 PM
TimHayes
Frequent Contributor
I have a Layer Group in my msd. I am using the TOC sample here: http://www.arcgis.com/home/item.html?id=e2cb71d5c04d40d19e9f945ae0db7ce8

It works great except I cannot figure out how to add a sublayer. The Layer Group is Electrical. Can someone let me know how to code <sublayer> the correct way? here is a small cut from the Layers in my config.xml

<operationallayers>
            <layer type="feature" label="Pipes" url="http://PrometheusServer/ArcGIS/rest/services/FlexTOCTest/MapServer/5" visible="true"/>
            <layer type="feature" label="Exposed Buried Utilities" url="http://PrometheusServer/ArcGIS/rest/services/FlexTOCTest/MapServer/3" visible="true"/>
            <layer type="feature" label="Electrical" url="http://PrometheusServer/ArcGIS/rest/services/FlexTOCTest/MapServer/0" visible="true"/>
            <sublayer type="feature" label="Duct Banks" url="http://PrometheusServer/ArcGIS/rest/services/FlexTOCTest/MapServer/2" visible="true"/>
            <sublayer type="feature" label="Handholes and Manholes" url="http://PrometheusServer/ArcGIS/rest/services/FlexTOCTest/MapServer/1" visible="true"/>
</operationallayers>
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus
Timothy,

  No you can not have it like that and here is the reason. The whole map service (the MSD) gets a checkbox and label so that the whole map service can be turned on or off and then each layer gets a checkbox (grouped layer or normal layer) so that you can turn on or off those layers. So to get what you are after you would need to publish an MSD without the group layer that way you would have just the main checkbox named electrical and the two layers under it:

chkbox Electrical <-- name of Map Service
chkbox Handhole <-- nested under Electrical
chkbox Manhole <-- nested under Electrical


Don't forget to click the Mark as answer check on this post and to click the top arrow (promote).
Follow the steps as shown in the below graphic:

View solution in original post

0 Kudos
4 Replies
RobertScheitlin__GISP
MVP Emeritus
Timothy,

   The sublayer tag is only for specifying a particular popup for a layer or a definitionexpression. Read more about what is supported as far as layers and what sublayers are for here:

http://help.arcgis.com/en/webapps/flexviewer/help/01m3/01m30000000p000000.htm

If you have a grouped layer in your MSD and publish that to ArcGIS Server than that grouped layer will be there and display just like it does in ArcMap when using my TOC widget. If you are wanting to add just certain layers of a map service then you need to look into the visiblelayers and definitionexpression

Don't forget to click the Mark as answer check on this post and to click the top arrow (promote).
Follow the steps as shown in the below graphic:
0 Kudos
TimHayes
Frequent Contributor
Timothy,

   The sublayer tag is only for specifying a particular popup for a layer or a definitionexpression. Read more about what is supported as far as layers and what sublayers are for here:

http://help.arcgis.com/en/webapps/flexviewer/help/01m3/01m30000000p000000.htm

If you have a grouped layer in your MSD and publish that to ArcGIS Server than that grouped layer will be there and display just like it does in ArcMap when using my TOC widget. If you are wanting to add just certain layers of a map service then you need to look into the visiblelayers and definitionexpression

Don't forget to click the Mark as answer check on this post and to click the top arrow (promote).
Follow the steps as shown in the below graphic:



I finally figured it out, thanks to you, but I have another sort of related question:

> I have a Layer Group in the MXD named Electrical with two layers in it: Handholes and Manholes.

> I created the MSD. Brought into the Flex Viewer using your TOC Widget. Works good, the Layer Groups appear as long as Electrical is dynamic. Except for one thing, not sure if this can be modified or not:

> The REST Service name is "Electrical", the Layer Group name is "Electrical". In the TOC both show up, the Layer Group is nested in the REST Service, both with check boxes next to them. Is there a way to remove one of labels "Electrical" along with it's associated check box, and still keep the Layer Grouping? I could rename one to "Electrical Assets" and keep one as "Electrical". But this still leaves those two check boxes. My goal is to have one check box and name "Electrical" and the nested layers (with their check boxes) inside it.

I am looking for a TOC format like this (this is not code, it's for illustrative purposes only):

chkbox  Electrical <-- name of Layer Group or REST Service
           chkbox Handhole <-- nested under Electrical
           chkbox Manhole <-- nested under Electrical


At the moment here is what it looks like:

chkbox Electrical <-- name of REST Service
          chkbox Electrical <-- name of Layer Group nested under REST Service Electrical
                    chkbox Handhole <-- name of Layer nested in Layer Group
                    chkbox Manhole <-- name of Layer nested in Layer Group


What are your thoughts?
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Timothy,

  No you can not have it like that and here is the reason. The whole map service (the MSD) gets a checkbox and label so that the whole map service can be turned on or off and then each layer gets a checkbox (grouped layer or normal layer) so that you can turn on or off those layers. So to get what you are after you would need to publish an MSD without the group layer that way you would have just the main checkbox named electrical and the two layers under it:

chkbox Electrical <-- name of Map Service
chkbox Handhole <-- nested under Electrical
chkbox Manhole <-- nested under Electrical


Don't forget to click the Mark as answer check on this post and to click the top arrow (promote).
Follow the steps as shown in the below graphic:
0 Kudos
TimHayes
Frequent Contributor
Timothy,

  No you can not have it like that and here is the reason. The whole map service (the MSD) gets a checkbox and label so that the whole map service can be turned on or off and then each layer gets a checkbox (grouped layer or normal layer) so that you can turn on or off those layers. So to get what you are after you would need to publish an MSD without the group layer that way you would have just the main checkbox named electrical and the two layers under it:

chkbox Electrical <-- name of Map Service
chkbox Handhole <-- nested under Electrical
chkbox Manhole <-- nested under Electrical


Don't forget to click the Mark as answer check on this post and to click the top arrow (promote).
Follow the steps as shown in the below graphic:


Thanks! this makes it easier. This is very helpful. I never thought of it this way.
0 Kudos