If the uniques in the layer of a service are not arranged from 0 to N, top to bottom, the result of 'create_view' will be unusable. I ran this code on a service with non-sequential ids:
source_search = gis.content.search("test_20240608_unique_ids_assigned_all_around")[0]
source_flc = FeatureLayerCollection.fromitem(source_search)
new_view = source_flc.manager.create_view(name="unid_all_around_view")
Layer order in service:
Layer order in view created by above script:
The view, when opened in the map viewer. The route, which is a line, has become a point layer. Activity 11016565550 GPXtoFeatures has become a line feature. A complete mess.
This only happens with 'create_view' in ArcGIS API for Python (in a notebook). If I make the view manually, this does not happen. create_view DOES work correctly when the order of layer ids in the service is 0,1,2... top-down. Has anyone else experienced this? Is it a bug? I have reproduced this on several platforms. ArcGIS API for Python cannot make a view from a service with non-sequential layer ids.
Looks like you have a reproducible case? If it's not working as expected with the latest version of the API, I'd say you should go ahead and log something here: Issues · Esri/arcgis-python-api · GitHub