GetLabelExpression()
Summary
Gets the label expression for a layer or selection set.
Syntax
expression = GetLabelExpression(string lyr_set_name)
| Argument | Contents |
|---|---|
| lyr_set_name | The name of the layer or selection set |
Returns
A string containing the field name or expression whose result is used as the label.
Notes
-
GetLabelExpression() will get the last label expression used, even if the label visibility is Off. You can test for the label visibility:
{visible} = GetLabelOptions(lyr_set_name, {"Visibility"}) if visible then ShowMessage("Using label " + GetLabelExpression(lyr_set_name)) else ShowMessage("Not using labels.")
Example
SetLabels("U.S. States", "Population/Area", {
{"Font", "Arial|Bold|16"},
{"Color", ColorRGB(50000,50000,0)},
{"Priority", "Population"}
})
x = GetLabelExpression("U.S. States|") // x = "Population/Area"
Error Codes
| Error Type | Meaning |
|---|---|
| NotFound | The specified layer or selection set does not exist, or a label expression has never been used on the layer |
See Also
| Function | Summary |
|---|---|
| SetLabels() | Enables or disables labeling for a layer or selection set |
| GetLabelOptions() | Gets the label option settings for a layer or selection set |