Select to view content in your preferred language

create_view Does Not Work with non-sequential Layer IDs

228
2
06-09-2024 06:12 AM
Labels (2)
RandyMcGregor_Home
Occasional Contributor

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:

RandyMcGregor1_0-1717938282729.png

Layer order in view created by above script:

RandyMcGregor1_1-1717938344630.png

 

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.

RandyMcGregor1_0-1717938863187.png

 

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.

0 Kudos
2 Replies
EarlMedina
Esri Regular Contributor

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

RandyMcGregor_Home
Occasional Contributor
0 Kudos