Aller au contenu principal

Get Layer by Layer name

Terminée

Commentaires

6 commentaires

  • Permanently deleted user

    I agree. It's really painful dealing with layer IDs, rather than names.


    I do think you can probably accomplish this by combining several existing activities. Maybe use the web request activity to make a request to the service, like https://<domain>/arcgis/rest/services/<folder>/mapserver?f=json. Then, you'd have to parse the json, and loop thru the layers array from the response, and compare the name of each layer against the layer name of interest. Perhaps it could be created as a separate WF that accepts a layer name as the input and returns the layer id, which can then be used as input to other activities.


    That said, nice if Latitude could just add this as an activity.

    0
  • Lee Kinser

    I have created a workflow that I use on start up of all of my viewers. I loop through the Site Info and convert the array into names. Now I can reference all layers by map service name and layer name.

    0
  • Sean Phayakapong

    This is what you are looking for to preserve the layer ID even when things are rearranged. I had the same issues as well until my organization had implemented this. http://desktop.arcgis.com/en/arcmap/10.3/map/publish-map-services/map-authoring-considerations.htm#ESRI_SECTION1_4C54586DEB0445B4B97AF15856E546AB

    0
  • Sean McClurkan

    One of our GIS Programmers, Lee Kinser, authored this workflow that we run at startup of all sites. It does a Set Application Data for the key SiteInfo

    All our workflows use a Get Application Data activity for SiteInfo and are able to set Map Service ID's and URL's, and Layer ID's and URL's by their Display Names (names are processed to remove underscores, empty spaces and special characters so County Boundaries is presented as CountyBoundaries

    You can also see all the values in the Console at runtime if you need to confirm a name format.

    SiteInfo exposes the Site Url, Mapservices with URL and ID, all Layers in the Map Services, Workflows, Search Tables, Basemaps, Database Tier (if your server name contains dev, test, prod, etc.), plus some other stuff.

    The workflow can be imported from here:


    https://austin.maps.arcgis.com/home/item.html?id=d231e70cb4c14fcfa8c2f5928428ed29


    IMAGE


    IMAGE

    0
  • Spatial Online Support

    Hi Sean, thanks for sharing your Site Info workflow, I can see this will be really useful for us!

    0
  • Ken Lyon

    Workflow does not reference layers by index. Activites such as Get Layer accept the layer id which is not quite the same thing. Also, when running in the 4.x API of JavaScript, workflow will also attempt to match on the name if the supplied id is not found in the map.

    0

Vous devez vous connecter pour laisser un commentaire.