Limiting decimal places in labels

25618
6
Jump to solution
04-28-2017 11:42 AM
ScottFraser3
New Contributor III

Original LIDAR ground elevation measurements go to about the 20th decimal, but I only need the labels rounded to one decimal point.

Using the following label expression, it rounded about 25% of the 2-million labels, but the remaining are still showing all 20 or so decimal places. (see attached image)

$feature.NGVD; round(number([$feature.NGVD]), 1)

The field name is "NGVD."

I'm purplexed as to why it appropirately rounds some but not all the labels.  They're all in the same data field. 

2 Solutions

Accepted Solutions
Robert_LeClair
Esri Frequent Contributor

Using VBScript in the Label Class Expression, I used the following snippet:

Round ([NGVD], 1)

and my output label then drew something like 132899.5 for example.

Hope this helps!

View solution in original post

Robert_LeClair
Esri Frequent Contributor

Excellent - glad it worked out!  Ha - yes, I was in the arcade as an early teen a lot of well playing Space Invaders and Asteroids.  This "arcade" is "fun" I guess in other ways programmatically.  If you're so inclined, please mark my answer as "Answered" so it closes this thread.  Thx!

View solution in original post

6 Replies
Robert_LeClair
Esri Frequent Contributor

Using VBScript in the Label Class Expression, I used the following snippet:

Round ([NGVD], 1)

and my output label then drew something like 132899.5 for example.

Hope this helps!

ScottFraser3
New Contributor III

Ahh... following up on your suggestion, I discovered - being new to Pro, that I wasn't in Python at all.  I was actually in some language called Arcade - which is ironic, given that as a kid you couldn't get me out of an arcade.

Once I discovered the "Language" drop-down list and switched to VBScript, using your code, then all was than right with the world... or at least it's elevations anyway.

Thanks.

Scott

0 Kudos
Robert_LeClair
Esri Frequent Contributor

Excellent - glad it worked out!  Ha - yes, I was in the arcade as an early teen a lot of well playing Space Invaders and Asteroids.  This "arcade" is "fun" I guess in other ways programmatically.  If you're so inclined, please mark my answer as "Answered" so it closes this thread.  Thx!

p288794Margaritis
New Contributor

How can we limit the decimal points when it comes to interpolation surfaces ? There is no Label tab or a Label expression option

0 Kudos
curtvprice
MVP Esteemed Contributor

A downside of this method is the number of decimals is not padded, ie 29.03 is displayed as "29" not "29.0". There is fortunately, another function (which also adds commas by default for large numbers):

FormatNumber([NGVD],1)

Or, using Python (note in Python you must float() the value, as the label parser gets the value as string, regardless of field type! -- VBScript of course, being VBScript, doesn't care about data type)

"{:0.1f}".format(float([NGVD]))
p288794Margaritis
New Contributor

How can we limit the decimal points when it comes to interpolation surfaces ? There is no Label tab or a Label expression option.

0 Kudos