1

Is there a way to use label expressions in ArcGIS 10.x to specify the font size for a label from the values in a field?

So as an example, I have a point dataset which I wish to label, and within the attribute table there is a numeric field called "size" which holds the size I want the label for that feature to be.

I've managed to use an expression to specify a font and a single size for the whole dataset

"<FNT name = 'Arial' size = '12' >" & [gml_id] & "</FNT>"

But if I try to replace the number 12 with the name of the field which holds the font sizes, the code doesn't work i.e.

"<FNT name = 'Arial' size = [size]  >" & [gml_id] & "</FNT>"

The above expression prints the expression as the label, rather than the values from the "gml_id" field. So this made me think that it was interpreting the whole thing as a string because it's all in double quotes, however removing the quotes gives me a syntax error.

"<FNT name = 'Arial' size = '[size]'  >" & [gml_id] & "</FNT>"

The above expression gives me no label.

"<FNT name = 'Arial' size = "[size]"  >" & [gml_id] & "</FNT>"

The above expression gives me a syntax error.

Anybody know where I am going wrong or even if this is possible?

2

You almost nailed it down.

"<FNT name = 'Arial' size = '" & [sizefield]  & "'  > " & [gml_id] & " </FNT>"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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