Description
The method FeatureLayerCollectionManager.create_view()
crashes for FeatureLayerCollections
with multiple layers in version 2.4.0. I checked this for a feature service with only one layer and then the function worked fine.
The error originates in fs_view.manager.add_to_definition(add_def, future=True).result()
in line 2972 of arcgis/features/managers.py
. The error seems to originate in the REST API (as opposed to the ArcGIS API for Python). The error message is "Unknown Error", while I can see another message is "Error applying service definition" when I am debugging.
In the summary of FeatureLayerCollectionManager.add_to_definition()
I see "For layer level modifications, run updates on each individual feature service layer object.
" This could be the problem?
I have a workaround for now. I copied the method and made my own implementation. Instead of adding all layers to add_def
I just loop over all the layers and call fs_view.manager.add_to_definition(add_def, future=True).result()
for each layer seperately.
It took me quite some time and frustration to first find the bug and to find a workaround.
P.S.
The typing for FeatureLayerCollectionManager.create_view()
is incorrect, and I have seen this incorrect for a lot of methods as well. The typing for the parameter view_layers
should be view_layers: list[FeatureLayer]
instead of list[int]
and view_tables: list[Table]
instead of list[int]
.