FeatureLayerCollection.manager.create_view creates view with incorrect number of sublayers (ArcGIS Online)

146
0
2 weeks ago
Dirk_Vandervoort
New Contributor III

In code:

 

 

 

 

schema_item = gis.content.get(schema_itemId)

view_layers =[]
a_layer = schema_item.layers[2]
view_layers.append(a_layer)
a_layer = schema_item.layers[5]
view_layers.append(a_layer)
a_layer = schema_item.layers[4]
view_layers.append(a_layer)
a_layer = schema_item.layers[3]
view_layers.append(a_layer)

flc = FeatureLayerCollection.fromitem(schema_item)
view_item = flc.manager.create_view(name=target_view_name, view_layers=view_layers)

 

 

 

 

A nice simple view with four layers. Clean code.

The results in the ArcGIS Online portal shows 2 layers in the view (WRONG!): 

Dirk_Vandervoort_0-1714755777079.png

The results in the REST catalog shows 4 sublayers (RIGHT!): 

Dirk_Vandervoort_1-1714755922116.png

 

Adding the view to ArcGIS Pro shows only 2 sublayers (WRONG): 

Dirk_Vandervoort_2-1714756177783.png

However I can add the sublayers one-at-a-time by the sublayer path: 

Dirk_Vandervoort_3-1714756302084.png

What's going on here? I need all four layers.

TIA

<EditEdit>

After poking around in the view using https://ago-assistant.esri.com/ I have identified that the id of the individual layers are oddly ordered - some repeats, some no-existent indexes, etc. If I manually increment the layer ids in the json, all layers are present and properly indexed.

</EditEdit>

0 Kudos
0 Replies