AnsweredAssumed Answered

What is the maximum number of views on a Hosted Feature Layer?

Question asked by EPolle_TensingInternational Champion on Mar 14, 2019
Latest reply on Jan 13, 2020 by jburdziej

Hi,

 

I just wondered: is there a limitation on the number of views you can create on a Hosted Feature Layer? In ArcGIS Online and/or in Portal for ArcGIS?

On this page (Create hosted feature layer views—Portal for ArcGIS | ArcGIS Enterprise) it is stated that

You can create a maximum of 20 views from the same hosted feature layer.

whereas on this page (Create hosted feature layer views—ArcGIS Online Help | ArcGIS) this limitation seems absent (although there is a limit of 20 to the number of categories you can assign to the item....)

And this limitation of 20 views on a Hosted Feature Layer in Portal for ArcGIS Enterprise, is that just a limitation of the UI which can be circumvented using a Python script, as kimberly peter states on GitHub (Add information and a sample for creating hosted feature layer views using Python · Issue #340 · Esri/arcgis-python-api … )?

 

With the Python script below I can create 25 views on a Hosted Feature Layer in ArcGIS Online. Would a similar approach be possible in Portal for ArcGIS Enterprise?

 

TIA,

 

Egge-Jan

 

from arcgis.gis import GIS
from arcgis.features import FeatureLayerCollection
from provide_credentials import provide_credentials

username, password = provide_credentials()
my_agol = GIS("https://www.arcgis.com", username, password)

service = my_agol.content.get("<serviceItemId_of_your_Hosted_Feature_Layer>")

flc = FeatureLayerCollection.fromitem(service)

clients = ['ONE','TWO','THREE','FOUR','FIVE','SIX',
'SEVEN','EIGHT','NINE','TEN','ELEVEN','TWELVE',
'THIRTEEN','FOURTEEN','FIFTEEN','SIXTEEN','SEVENTEEN','EIGHTEEN',
'NINETEEN','TWENTY','TWENTY-ONE','TWENTY-TWO','TWENTY-THREE','TWENTY-FOUR',
'TWENTY-FIVE']

for client in clients:
    view_name = service.name + "_View_" + client
    print(view_name)
    view = flc.manager.create_view(name=view_name, spatial_reference=None, extent=None, allow_schema_changes=True, updateable=True, capabilities='Query, Update', view_layers=None)
    for lyr in view.layers:
        query = "Description = '%s'"%(client)
        print(query)
        lyr.manager.update_definition({'viewDefinitionQuery': query})

Outcomes