3

I've been labeling using the LabelEngine and simple expressions and it is working for every layer. I want to offer the option of labeling only selected features and thought it would be this simple:

annotateLayerProperties.LabelWhichFeatures = esriLabelWhichFeatures.esriSelectedFeatures;

Unfortunately that doesn't do it. Every polygon is still labeled. I verified that the features were selected (I have a routine that just returns the selected keys.) I also tried replacing the Engine labeling with a:

annotateLayerProperties.WhereClause = BuildWhere( keyName, selected );

using both my keys and the features OIDs - that does not label at all.

Does anyone know how to label only the selected features?

1
  • I have just a quick two cents worth. I too am looking to label only "selected" features. I am printing small (8.5" x 11") working copy maps for field workers to use while checking business addresses for accuracy. If I send them out with a small map to a group of businesses on a street corner, I want ONLY the addresses for the businesses that I select and in a size that makes it easy to make corrections directly in the address fields I have printed. Unfortunately, at the scales that I want to use, I get ALL of the businesses and ALL of the idividual apartment numbers nearby. That makes it impos
    – user9846
    Commented Aug 29, 2012 at 16:10

2 Answers 2

3

Labeling selected features is not currently possible in ArcGIS. The value you are setting on the property LabelWhichFeatures is overwritten by the labeling process and is not intended to be a persisted setting for this purpose. It main exists to power Convert Labels to Annotation which has a selected features option.

There is an existing enhancement request to provide labeling for selected features, but we'd like to understand the workflows that people are trying to fulfill with this requested functionality. If you can provide any details here, it would be helpful. <- If it is not obvious, I work on labeling at Esri.

5
  • Simple example: the user is trying to print a map (not persist data for all time!) with a list of properties derived from a joined database table using only a limited subset of features previously selected. OR maybe they want to compare feature properties dynamically based on the the selected subset.
    – Chaz
    Commented Dec 16, 2011 at 15:28
  • Also, just from a usability standpoint having fewer labels on screen makes it easier to see the labels and diminishes the need for tweaking to make to make them legible.
    – Chaz
    Commented Dec 16, 2011 at 15:31
  • Can I also ask another question? Is it possible to use balloon callouts in dynamic labels or must they be converted to annotations also?
    – Chaz
    Commented Dec 16, 2011 at 15:33
  • I would like to point out that the IAnnotateLayerProperties.WhereClause can be used to label only selected features if you can build a working clause for the selected keys. Took me a while to get this to work because it would only accept a field name without delimiters (even tho elsewhere it requires the delimiters!?)
    – Chaz
    Commented Dec 21, 2011 at 14:50
  • Obviously I understand the need to label subsets, but when doing the analysis you mention in the first comment, would you want to show this with the feature selection symbol etc. too? I imagine in most cases I would create a new layer with a definition query so it is a bit more permanent than a selection. Commented Jan 19, 2012 at 2:41
1

One possible work around is to: "create layer from selected features" and label that (maybe making all the geometry transparent). A smart cookie could make a model or add-in to do it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.