getAttribute of graph shape (python)

284
2
11-02-2023 08:17 AM
MJF
by
New Contributor II

Hi, I noticed that when I'm calling getAttribute() in my python script to retrieve object attributes for graph objects, it only returns them for segments and nodes, but not for the shapes. For shapes it returns None.

Since the shape is generated out of the segments and nodes, it has the same object attributes, as visible in the inspector.

Is that intended behaviour? Is there no way to get object attributes for graph shapes?

0 Kudos
2 Replies
SimonHaegler
Esri Contributor

Hi,

the inspector behaves differently than Python.

If you select a street shape, also its "parent" graph segment  (or node) is selected and the Inspector shows the combined set of attributes from nodes, segments and shapes (scene objects).

Python's getAttribute (or getAttributeList) is closer to the underlying data structure and returns only the actually owned attributes of a scene object.

I hope this helps & best,
Simon

0 Kudos
JonasObertuefer
Esri Contributor

In addition to what Simon said:

  • If you add new object attributes through the Inspector UI they will always be added onto the node/segment and not the dynamic shape, see also object attribute inheritance
  • There are some specific object attributes for graph shapes like sidewalkSide and shapeType. Those will be listed when you query them in python:

 

# select a graph shape
print ce.getAttributeList(ce.selection()[0]) 
# OID of the segment/node is the same as the shape
# minus the last two chars, those are used to number the shapes
segmentOID = ce.getOID(ce.selection()[0])[0:-2] 
print segmentOID
print ce.getAttributeList(ce.findByOID(segmentOID))​

 

Cheers
Jonas

0 Kudos