Creating views from feature service doesn't include Tables

74
1
01-09-2020 11:23 PM
Highlighted
New Contributor III

Currently flc.manager.create_view(...) doesn't seem to publish any tables that are part of the service. Is there a way to do that using the API with some other parameters,etc? I have tried to use view_layers explicitly defining the layer as well but it doesn't seem to make any difference. Ideas?

from arcgis.gis import GIS
import getpass

password = getpass.getpass("Enter password: ")

gis = GIS('organization', 'username', password)
print("Connected to: {}\nConnected as: {}".format(
gis.properties.urlKey + "." + gis.properties.customBaseUrl,
gis.users.me.username))

folder_name = 'TestFolder'
folder = gis.content.create_folder(folder=folder_name)
folder

created_item = gis.content.add(
item_properties={
'title' : 'Test',
'type' : 'Service Definition',
'tags' : ['TEST'],
},
folder = folder_name,
data= r'./data-publish/HSLCityBikes.sd')

published_service_item = created_item.publish()
published_service_item.update(thumbnail="./data-publish/esriDefaultMarker_189_Green.png")
published_service_item

from arcgis.features import FeatureLayerCollection

capabilities = "Query"
title = published_service_item.title + " (ReadOnly)"

flc = FeatureLayerCollection.fromitem(published_service_item)
created_view_item = flc.manager.create_view(name=title, capabilities = capabilities)
created_view_item.move(folder=folder_name)

Original service

Created view

Reply
0 Kudos
1 Reply
Highlighted
New Contributor

Hi @AnttiKajanus,

Were you able to resolve this issue? I'm having the same problem. tables are not included in the created view!

Reply
0 Kudos