Labeling issues/bug with layer of selected features in ArcMap 10.5

6230
18
10-17-2017 10:09 AM
Kevin_ASieger
New Contributor III

I'm having labeling issues in ArcMap 10.5 with lines and polygons layers created from a selection, I have not tried to label a selection of points but I'm guessing the issues is the same.

1. I select features for my map and create a layer of my selection.

2. I open the Layer Property window for the new layer that contains the selected features.

3. Under the Label tab I check 'Label features in this layer', change the Label Field and click OK.

4. The window closes and all features from the layer I selected from appear with the label I selected.

Some things I found that need to be noted about this issues/bug:

1. If I create a layer of my selections and on turn on the label but not change the Label Field everything is good to go, the layer of selected features appears as it should with 'default' label. The only work around I have is to create a Shapefile of my selection.

2. I don't have to turn labels on to have this happen, all I have to do is change the Label Field.

3. If I open the attribute table of the layer created from my selection only the selected features are in the table, but after I close the attribute table and go through the steps above all features from the source layer appear.

18 Replies
Kevin_ASieger
New Contributor III

I've seen the question come up several times (this post and others)- how to work around or deal with this issue.

I do a lot of data collection and custom mapping, I work for an airport, there's a lot to do. I haven't found a work around that's 'easy' or simple or doesn't involve extra steps when it comes to labeling a layer created from selected features, but what I have found does deal with the labeling issue and solves some other issues too. I think this is the best most direct work around and, going forward, even if Esri fixes the labeling issue, I'm going to keep doing it this way.

All of my maps and projects has it own folder, mxd, and File Geodatabase (or Personal depending on the project) which contains all custom Feature Classes and Tables for the map/project. My work around is to export my selection to a Feature Class in the GDB instead of a creating a layer of selected features in the mxd. I create maps for various departments such as Properties, Environmental, Operations, and Maintenance to the Airport Director. It has happened many times that I have had to come back days, weeks or months later to make changes to a map.This usually involves making changes to a layer(s) of selected features. I have silently cursed or have gotten frustrated trying to remember the selection or redoing the selection because I missed a feature or two or have gotten too many or the wrong ones. A custom layer in a GDB with a mxd in a folder, the data is there, it's easy to make needed changes, and no cursing, headaches or frustrations or labeling issues. The labeling issue has added to the frustration when going back to some of the maps that were created before we started having labeling issues. As I said before, we only started having the labeling issue with our move to 10.5.1. There have been a few instances where I have exported my selection to a Shapefile but have stopped creating Shapefiles due to having to stop editing one layer to start editing another, a GDB solves the stop/start when editing.

Labeling issue aside, I've found creating custom layers of features an easy way to preserve and recover all of your data after a map/project has been archived and then later on reopened for whatever reason. With reopening maps I have had issues trying to recreate selections due to disconnected data. It also makes it easier for someone not familiar with the project to recreate the map.

Now, I can hear it because I've heard it before, if you have custom layers and the file path changes you have to reconnect all of the layers. Based on the larger picture, I would rather reconnect 20 layers of data than sit there and try to figure out what was in a selection.

Yes, I know it's extra work to create a GDB for every map but in the end I think it has saved me time and if you have to deal with funding/budget it'll save money.

Reply
0 Kudos
JenniferNolan
New Contributor

I just experienced this problem as well in 10.5.1. My easy workaround was to make the selection layer, then export the data into my geodatabase. Since ArcMap prompts if you want to add the layer to the map, it's really only a couple of extra clicks. 

Reply
0 Kudos
NaomiBegg2
Occasional Contributor III

Apparently the bug is still present in ArcMap 10.6 too.

Reply
0 Kudos
Kevin_ASieger
New Contributor III

Someone posted (on another page I'm following about this same issue) about a fix with 10.6.1 release. I have no way to verify his post, I searched for the bug but didn't find anything. Here is where his post is- Selections saved as layers revert to original table 

Reply
0 Kudos
JoãoMartins3
New Contributor II

Here's the webpage for BUG-000106791:

BUG-000106791: In ArcGIS Desktop 10.5.1, creating a layer from the .. 

The workaround suggested by ESRI is not a viable alternative:

"Export the data and then make changes to it by selecting the features > Right-click Layer > Data > Export Data."

How could this bug be fixed for version 10.5.1?

Any ideas?

AndrewLowerre
New Contributor III

I've run into the same problem, which only appeared after moving to Desktop 10.5.1. I agree that the work-around currently suggested by Esri is less than satisfactory.

I've found the following seems to work:

Create your selection-based layer as you would normally, but before trying to add labels or change the symbology, open the Python window in ArcMap, then enter this code:

print([r[0] for r in arcpy.da.SearchCursor("SelectionLayer", "OID@")])

or, perhaps even better:

print(", ".join(str(r[0]) for r in arcpy.da.SearchCursor("SelectionLayer", "OID@")))#Doing this means there will be no enclosing brackets on the output‍

where "SelectionLayer" is the name of your selection-based layer in the ArcMap Table of Contents.

This will print out in the Python window a comma-separated list of all the ObjectIDs for the features in your selection-based layer.

Copy that list, then open the Layer Properties for your selection layer and go to the Definition Query tab.

Write the definition query as

OBJECTID IN (>>paste the list of OIDs here<<)

Just make sure you have the correct field delimiters around the name of the OBJECTID field (i.e., none for an enterprise geodatabase, "" for file geodatabase or shapefile, [] for personal geodatabase).

Essentially, this just 'converts' the selection-based layer into just another layer with a definition query based on the OIDs of your selected features (which I suspect is what's supposed to be happening behind the scenes anyway, but which seems to have gone wrong with 10.5.1, and even earlier for some people).

You should then be able to modify the layer (symbology, labels, whatever) without it reverting to show all of the underlying feature class.

Anyway, I've found this works for me, and avoids having to export copies of the selected features. I'd be curious to hear if it works for other folks.

Cheers,

Andrew

AndresCastaneda
New Contributor

I have had the same happen with my projects. It is a fairly recent problem and I am on 10.6. I just had it happen twice today and figured a way to keep it stable. I made sure the source layer was labeled, then I created the layer from selection. I then shut off the source layer. Everything is okay. This is where labeling the new layer with the properties box creates the issue. I instead used the labeling manager. I changed the expression and the font, and hit apply. It kept the same selection without clearing it. Hope this helps. 

Although I noticed opening the properties box for anything resets the selection. So if labeling is your only problem, it will work. Anything else will still cause it to clear out. 

Andres

Reply
0 Kudos
Village_ofDowners_Grove
New Contributor II

Frustrated by this issue, I tried many things.  I discovered that if I alter the field the label is referencing from Label Manager, it retains the selected set.

Reply
0 Kudos
MeganHalbrook
New Contributor

I'm having the same problem and it's driving me insane

Reply
0 Kudos