FeatureLayerCollection issues

398
2
Jump to solution
11-22-2023 11:49 AM
YS2388
by
New Contributor III

Hello,

I am relatively new to the python API. There is something I am not understanding about featurelayercollections (flc). In AGOL, I have a feature service with a point layer and a related table. This is feature service is an flc:

<Item title:"123" type:Feature Layer Collection owner:123>

According to the documentation, I should have access to properties such as "relationships" or "manager". I wanted to use the flc manager to add a layer to the service but running the code:

flc.manager.insert_layer("path")
 
An error: 'Item' object has no attribute 'manager'
 
What am I missing here?
 
Thanks,
Tags (1)
0 Kudos
1 Solution

Accepted Solutions
EarlMedina
Esri Regular Contributor

Based on the error and other provided information, it seems you are working with a  FeatureCollection Item and not a FeatureCollection object. 

Try doing this:

from arcgis.features import FeatureLayerCollection
flc = FeatureLayerCollection.fromitem(flc_item)

 

where "flc_item" is what you are currently working with

View solution in original post

2 Replies
EarlMedina
Esri Regular Contributor

Based on the error and other provided information, it seems you are working with a  FeatureCollection Item and not a FeatureCollection object. 

Try doing this:

from arcgis.features import FeatureLayerCollection
flc = FeatureLayerCollection.fromitem(flc_item)

 

where "flc_item" is what you are currently working with

YS2388
by
New Contributor III

Thank you for the clarification Earl! That was the issue. A few things I noticed:

flc.manager.layers  -  Returns related table as part of the layers list.

flc.manager.tables  -  Does not recognize related table, returns an empty list.

flc.relationships  - returns an empty list. I am not familiar with the "supportsRelationshipsResource" property...

Thank you.

0 Kudos