arcgis-python-api
arcgis-python-api copied to clipboard
swap_view does not work Hosted Feature Services with multiple layers
Describe the bug The swap_view function allows the ability to swap the source of the view to a different Hosted Feature Layer.
https://developers.arcgis.com/python/api-reference/arcgis.features.managers.html#arcgis.features.managers.FeatureLayerCollectionManager.swap_view
Hosted Feature Layer Views can only be configured against a single service.
When using the swap_view function, you pass the layer index, as well as the new layer source. The current function will never work where more than one layer exists in the view, as soon as you try and change one layer, an error is returned saying the view does not support multiple services, this is because the function requires a layer index.
To Reproduce Steps to reproduce the behavior:
- Create a Hosted Feature Layer View against a service with multiple layers. Ensure the view has multiple layers.
Assume 2 layers exist (0,1).
- execute the function:
swap_view(0,"https://services-eu1.arcgis.com/xyz/arcgis/rest/services/ServiceName/FeatureServer/0")
error:
--- Swapping View Layer Source ---
Unable to add feature service definition.
View layers can reference only one source service (ServiceName).
(Error Code: 400)
--- Swapping View Layer Source ---
Unable to delete feature service definition.
Object reference not set to an instance of an object.
(Error Code: 400)
Expected behavior It is expected that this function should be able to provide a mechanism to swap a view with multiple layers. I expect this is as designed, but it currently not very useful.
Platform (please complete the following information):
- OS: Windows
- Browser [e.g. chrome, safari]
- Python API Version [e.g.
2.3.1]