Zum Hauptinhalt gehen

Change Group Layer Visibility

Kommentare

10 Kommentare

  • Permanently deleted user

    So, I've tried adding the folder to the MapService so it now has an ID that I can access, however; it still doesn't seem to be working.

     

    Also, side question, is there a way to dynamically get the ID of layers in WF5? When I added the group layer it made all the ID's shift so I had to update the URLs for all my query tasks ...

    0
  • Permanently deleted user

    Hi Odiri,

     

    I can use Set Layer Visibility to set a group layer's visibility, but I'm not sure if that'll be what you're looking for.

     

    As a test, try moving your layer to the very top of the layer list, outside of any folders, and see if a workflow can set its visibility then. If it's a folders issue, there's an Idea you could vote for here: https://communities.geocortex.com/workflow/s/ideas#087f2000000XgbrAAC

     

     

    There might be a more graceful way to do it, but I've used this method to get a layer ID based on a map service id and a layer name:

    1. Add a Get Layer activity with just the Layer Id filled in with the map service's id value from Essentials
    2. Use the result from that activity in an expression like this, where "Zoning" is the name of your layer =$layer1.layer.layerInfos.find(sublayer => sublayer.name =="Zoning").id

    I'd definitely recommend posting an idea to request adding something like a "Sublayer Name" property to the Get Layer activity. That would make the process a lot friendlier.

    0
  • Permanently deleted user

    Hey Amanda,

     

    That's quite the expression just for an ID, but it works.

     

    I did some testing with the group layer visibility. Turns out, when I make the group layer visible, it's turning on all the layers inside the group, but it doesn't make the group itself (the containing folder) visible. So I'm still not able to see any of the layers in the group.

     

    So definitely a folder issue and I've voted for the idea.

    0
  • Permanently deleted user

    Hi Amanda, thanks for the tip about layerinfos.find function. Without this post I won't be able to know it exits as I couldn't find the "layerinfos" as a property of the Layer object returned from Get Layer.

     

    Meanwhile, I'm wondering how I could insert a string varible in the arrow function (find). I have tried several ways as below but all leads to error.😥 thanks.

     

    =$getLayer.layer.layerInfos.find(sublayer => sublayer.name === `"$forEach2.item"`).id

     

    =$getLayer.layer.layerInfos.find(sublayer => sublayer.name === "\""+$forEach2.item+"\"").id

     

    =$getLayer.layer.layerInfos.find(sublayer => sublayer.name === '"'+$forEach2.item+'"').id

    0
  • Permanently deleted user

    Hi Jack,

     

    Assuming that $forEach2.item is a string, try like this:

    =$layer1.layer.layerInfos.find(sublayer => sublayer.name==$forEach2.item).id

     

    "find" is actually an array method, you can read about it here:

    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find

    0
  • Permanently deleted user

    Thanks Amanda,

    Yes   sublayer.name==$forEach2.item works! One thing I learnt also is the the Layer object returned from Get Layer is actually the ArcGISDynamicMapServiceLayer https://developers.arcgis.com/javascript/3/jsapi/arcgisdynamicmapservicelayer-amd.html, rather than the Lay

     

    er class https://developers.arcgis.com/javascript/3/jsapi/layer-amd.html which is referenced in the Workflow Designer for the output layer. That's why I couldn't find the layerInfos property in the Layer class at the first time.

    0
  • Permanently deleted user

    Can I just get clarity on what is meant by a 'Group Layer' vs a 'Folder'? I have a problem and not sure if its related to this discussion where I am unable to make my Folder visible in the workflow.

    0
  • Permanently deleted user

    The two are interchangeable in a way. In the map service, a layer that contains multiple layers is called a "group layer". You can confirm this by looking at the type of the layer in your own map service.

     

    When you import a map service into Geocortex Essentials, it calls a group layer a folder. From what I can tell though, it may not actually import the group layer at all and instead makes a folder with the same name, which is what's causing the issue with making group layers / folders visible.

     

    While you're able to turn on the group layer in the service, you're unable to turn on the folder in Essentials from workflow 5.

    So, this means that all the layers in the group layer will be turned on (checked / visible) if you make the visibility true in workflow 5, but they will still be invisible on the map because the folder they are in is still turned off (unchecked / invisible) in Essentials.

    0
  • Permanently deleted user

    I'm still encountering this issue in WF 5.13.0 Are there any workarounds?

     

    0
  • Permanently deleted user

    What worked for me is to add the folder I want to turn on and off as a group layer, then use Set Layer Visibility with just a layer id (usually 0 if there is only one group layer) and NOT specify a sublayer.

    0

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.