Select to view content in your preferred language

What is the best way to automate view layer creation?

294
0
06-29-2022 08:31 AM
AnnaGabrielli
New Contributor II

Hi all,

I am looking for the best way to automate view layer creation based on a hosted Feature Service with multiple layers and related tables.

The ArcGIS Python API has recently started to have a bug where view layer creation (function sourceFeatureLayer.manager.create_view(title = title, layers = layers, tables = tables)) on these layers creates the view with all of the layers and tables, however layer 0 never appears in the content page and cannot be visualized or looked at in the data tab. However, all of the layers are created in the view correctly (according to API response), the viewDefinitionQuery is applied to all layers correctly, and the layers appear correctly on the rest service page. 

Cloning view layers fails for feature services with related tables with the following error:

"Failed to create Feature Service Incidents: Unable to add feature service definition.\nThe operation failed because an index or statistics with name 'id_unidx' already exists on table 'db_54931.user_54931.NAME'.\n(Error Code: 400)", <Item title:"NAME" type:Feature Layer Collection owner:agabrielli_geomarvel>

 

At this stage, I am thinking using the REST API directly with the following workflow (same workflow as creating a view in AGOL) may be the best solution but would love to see a solution in REST JS or the Python API

  • /createService to create a view service based on my source data
  • /addToDefinition and add the viewDefinitionQuery info
0 Kudos
0 Replies