Hoppa till huvudinnehållet

Is there a way to get a list of all the layers on the viewer

Kommentarer

10 kommentarer

  • Permanently deleted user
    Not sure if you mean only the visible layers or not, but assuming this you could write a clientside activity and interrogate on a map service basis:

     

    e.g. geocortex.framework.applications[0].map._layers[mapserviceid].visibleLayers;

     

    If you just want all layers you could use app.site.essentialsMap.allLayers() but this is also achievable serverside seeing as that info is in the site.xml .. e.g. you could get it via REST.

     

    Glenn
    0
  • Kevin Penner
    Hi Halil,

     

    Another suggestion would be to tag the layers with a layer property in REST Manager and then retrieve a list of LayerInfos via the GetLayerInfoByProperty activity in workflow. This will return all the layers which you tagged with an arbitrary property key value.

     

    You can then show a list of layers by their display name, and the LayerInfo will have all the info required to query chose layer.

     

    -Kevin
    0
  • Halil Siddique
    So, going through this again, I have created a tag for a layer, and have been able to populate my combo box with layers that have that tag. Aproblem that I have found is that its takes too long, as the workflow first has to download the JSON for each map service and then download the JSON for each layer in that map service just to check if the tag exists for each layer.

     

    So that is where I am at the moment...

     

    Does anyone know how I can hook onto whatever the Query and Filter tool uses to populate its combo box, as it also honours the Layer Themes, which mine doesnt do.

     

    Thanks

     

    Halil
    0
  • Ryan Kelley
    I am also curious about a solution for this. ArcGIS Onlines Web App Builder has an on-the-fly analysis widget, that allows one to overlay layers, and get a result. I am trying to achieve something similar, but also write it so it is dynamic enough with a workflow to be used in ANY viewer, so long as the workflow exists in the Site.xml.

     

    There should be an easier way to get the layer list in the TOC, other than the options provided so far, I would think. If this is out of the box, with AGOL's web app builder, Latitude should (hopefully) be looking into incorporating this soon.

     

    Ideally, the workflow would execute, query the TOC, and present two list boxes showing the layers in both. User can pick one item in each list box... and the rest of the workflow works out the analysis for the overlay. That is how the aforementioned AGOL widget works anyway.
    0
  • Permanently deleted user
    If the process used for Query and Filter tools to populate the list of all layers as a command we can use, that will be great. For now I have the list of layers in a table in a database, so I can pull them quickly. I have a process to update this table whenever I update map services. But this is not what I really wanted to do. It is just a workaround.
    0
  • Halil Siddique
    Thanks Lauren, just now need to think how to get the Map Service details from a selected layer on the list.
    0
  • Tyson Schoepflin

    @Halil Siddique

     

    This is the exact issue I've run into.  I can't figure out how layerlistiteminfo is linked to a map service.

    Within workflow these are the only properties and methods exposed.  The Id appears to be for the the layer list itself and is not related to a service id or a layer id.

     

    Properties

     

    IsVisible :: IsEffectivelyVisible :: IsExpanded :: HasChildren :: Name :: Id :: ParentId

    Methods

     

    get_Id :: set_IsVisible :: get_IsVisible :: get_IsEffectivelyVisible :: set_IsEffectivelyVisible :: set_IsExpanded :: get_IsExpanded :: get_HasChildren :: set_HasChildren :: set_Name :: get_Name :: set_Id :: set_ParentId :: get_ParentId :: ToString :: Equals :: GetHashCode :: GetType
    0
  • Halil Siddique
    @Latitude, is there any way to get the map service information from the layerlistiteminfo?
    0
  • Mike Ketler
    Hi Halil,

     

    The "GetLayerListitemInfo" activity is used to get the layer list information when supplied with a layer name or layer id (preferred). Using the "SetLayerListItemInfo" activity will allow you to change the visibility of items in the layer list, or expand/collapse the layer list selected. 

     

    If you need to get information about the map service then I'd suggest using the "GetMapServiceInfo" activity.

     

    Thanks,

     

    Mike Ketler
    0
  • Permanently deleted user
    I'm somewhat disappointed, as I have been back and forth in the support posts over and over looking for this same sort of thing.  There HAS to be a link somehow between the MapService and the layer IDs within that service. 

     

    As far as I can see, GetMapInfo gets you a list of map service IDs which is great, but then no way at all to easily tie these Map Service IDs back to the layers in the TOC.  Honestly, I cannot see ANY methods for accessing the TOC at runtime and listingthe layers and whether they are visible or not, if you don't have the layer IDs already.

     

    Thanks to everyone above for ideas about how to circumvent this issue.  GCX, any idea whether some better tools will be available these activities in the future?
    0

Du måste logga in om du vill lämna en kommentar.