Label if a Layer is a Hosted Feature Service in ArcGIS Pro's Table of Contents

1137
4
06-28-2019 02:29 PM
Status: Open
Labels (1)
JudyMak
New Contributor II

It'd be great if, in ArcGIS Pro, a layer would indicate if it was a hosted feature service. This is because I often pull copies of hosted feature service layers offline (or inversely, publish an offline layer), then work with both layers in the same project. I can easily get the two layers--which have the same name--confused.

Furthermore, there have been times when I thought a layer was hosted when it wasn't or vice versa, which causes confusion. This is especially important since edits made to a hosted feature service layer can't always be undone.

Here's a mockup picture of what this might look like if I published a layer, then added the hosted feature service version of that to the project afterwards:

Example of a Layer with

4 Comments
KoryKramer

Hi Judy Mak‌.  I marked the idea reviewed.  For now, you might want to just rename the hosted layer 'Centerlines (HFS)' and you've effectively got what you need.  If you already have both layers in the map, just go to the layer properties to see which is the hosted layer and then rename it:

DuncanHornby

I think this idea mirrors the idea of being able to visually see if a layer is built from a definition query or a selection (more relevant to ArcMap) in the ToC.

JudyMak

I'm not sure when this was implemented, but it appears that the most effective solution is to change the contents pane view to 'List by Data Source'. This request has been fulfilled.

Contents Pane - List by Data Source - Label Layer by Service Status/File Type

RussellBrennan

The code below (or a slightly modified version) should also give you the behavior you are looking for.

Run this from the python window with the map you are interested in renaming layers for.

aprx = arcpy.mp.ArcGISProject("CURRENT")
map = aprx.activeMap for lyr in map.listLayers():
    if lyr.dataSource.find("FeatureServer"): # can change "Feature Server" to any text that might be in your URLs
        lyr.name = lyr.name + " (HFS)" # can change "HFS" to any label you want.

Note that you can change "FeatureServer" to any part of the URL you want to use to identify your layer as a service layer. You can also change what gets appended to the layer name by changing (HFS) to something else eg: (Service Layer) or similar.