SaultDon

Convert Labels/Annotation to Points using Python 9.3, get centroids

Discussion created by SaultDon on May 9, 2011
Latest reply on May 11, 2011 by SaultDon
I have a problem where I need to generate a point for every label but would like to do it with python  using the shape geometry and have came up with the following results...

[ATTACH]6443[/ATTACH]

The red '0' is the actual label from the feature class, it is being drawn dynamically (not stored as annotation)

When using Calculate Geometry and
!shape.Centroid.*!
they share the same location, like a weighted/centre of gravity point.

The
!shape.Centroid.*!
and
!shape.LabelPoint.*!
return the same point, and neither is actually on the label point...


A workaround, is to convert the labels to annotation (in a gdb), then add two new x/y fields and calculate the geometry of those, then create an XY theme from those two fields. Note that the x/y given will be a bounding box of the annotation, so multi-line labels can affect this. I generate x/y on a label with a single character.


But like I mentioned, a python solution would be nice. The shape.LabelPoint sounded so promising!

Attachments

Outcomes