Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swap_view does not work Hosted Feature Services with multiple layers #2029

Open
stevewayuk opened this issue Sep 12, 2024 · 2 comments
Open
Labels

Comments

@stevewayuk
Copy link

stevewayuk commented Sep 12, 2024

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:

  1. Create a Hosted Feature Layer View against a service with multiple layers. Ensure the view has multiple layers.

Assume 2 layers exist (0,1).

  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]
@stevewayuk stevewayuk added the bug label Sep 12, 2024
@achapkowski
Copy link
Contributor

You are passing in a URL, it takes Table or FeatureLayer

@stevewayuk
Copy link
Author

You are passing in a URL, it takes Table or FeatureLayer

I've tried both ways.....it still provides the same error.

It is because when you specify a layer index, then at some point the view would have layers from multiple services.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants