Custom text for labels?

209
5
Jump to solution
2 weeks ago
Labels (1)
JillClogston
New Contributor III

Hi Community!

I would like to create a label for a layer that has an attribute table of only one row - just object ID and coordinates. I would like to give the layer a custom label. Is there method for accomplishing this or should I just add a new field to my table with the label I want to use?

Thanks in advance!
Jill

The custom label would simply be text, either a year or the name of a group of whales.

JillClogston_0-1714750125747.png

 

0 Kudos
1 Solution

Accepted Solutions
RhettZufelt
MVP Frequent Contributor

With just one feature, and you want to add text to label:

RhettZufelt_1-1714753410847.png

 

 

R_

View solution in original post

5 Replies
EdMorris
Esri Contributor

Hi

You can do this by creating a simple Python label expression. All you need to do is:

1: Labelling tab > Label button to label the features.

2: For Field choose the Expression button.

3: In the Label Class dialog change the Language to Python

4:Write the following Expression:

"OID: " + [OID] + "\nXCOORD: " + [XCoord] +"\nYCOORD: " + [YCoord]

5: Press the Check button to check the syntax and then the Apply button.

Hopefully that is it.

Many thanks ed

 

DuncanHornby
MVP Notable Contributor

If it really is one point and the label you want to display is information that does not exist in any part of any attribute then you can simply type the text as shown below.

DuncanHornby_0-1714752997026.png

But this approach in my opinion is you being slack and that will only come back and bite you...  What happens if you want to share this data or some other might want to do some spatial processing with your data? Your label exists nowhere but in the layer in the project. I would create a new field and populate it with the text that will become the label. Then it is clear where the label is coming from and becomes useful information that you or others can take advantage of.

 

JillClogston
New Contributor III

Great point, thank you!

0 Kudos
RhettZufelt
MVP Frequent Contributor

With just one feature, and you want to add text to label:

RhettZufelt_1-1714753410847.png

 

 

R_

JillClogston
New Contributor III

Thank you! Works perfectly. 

And the T2Cs are one of my favorite families. I was able to see how well they took care of Tumbo before he passed. 🤍

Jill

0 Kudos