Select to view content in your preferred language

Label Expression access to SHAPE

492
2
05-13-2023 03:56 PM
TylerT
by
Frequent Contributor

Hello,

It dawned on me that Label Expressions do not have access to the SHAPE column.  It would be nice to write (pseudo code):  SHAPE.area(), SHAPE.len(), etc directly...ie. not add/calc new area and length columns.  Any thoughts or workarounds on this topic?  Thx.

Tyler

ArcGIS Pro 3.1.0

2 Replies
JohannesLindner
MVP Frequent Contributor

Switch to Arcade, it has those options.

var a = Area($feature)
var p = Length($feature)
var v_num = Count(Geometry($feature).rings[0])
var v0 = Geometry($feature).rings[0][0]


var lines = [
    v_num + " vertices",
    "first vertex: " + Round(v0.x, 1) + " / " + Round(v0.y, 1),
    "area: " + Round(a, 1) + " m²",
    "perimeter: " + Round(p, 1) + " m",
]
return Concatenate(lines, TextFormatting.NewLine)

 

JohannesLindner_0-1684085633090.png

 


Have a great day!
Johannes
0 Kudos
RhettZufelt
MVP Notable Contributor

Where are you trying to write the label expression?  I see these fields and am able to utilize them in label expression in 2.9.3 and 3.1.1.

RhettZufelt_0-1684166114970.png

 

R_

0 Kudos