Hello everyone,
I am trying to get the list of feature service which has a specific layer (for example WETTBEWERBER (the layer id is 0)) from a feature service,
from arcgis.gis import GIS
gis = GIS(url='https://url/portal', username='arcgis_python', password='amazing_arcgis_123')
layer_items = gis.content.search(query="WETTBEWERBER", item_type="Feature Layer")
for layer in layer_items:
if "WETTBEWERBER" in layer.title.upper():
print(f"Layer name: {layer.title}, \tOwner: {layer.owner}, \tLayer ID: {layer.id}") But no results are printed out, but the layer WETTBEWERBER is present in most of my feature services. What can be done in this case ??
I have tried to get the layers first using the following code to check whether I can get the layers using the API and I can get the layers.
layer_items = gis.content.search(query="5fg239sdsfs56sdfcs466s4f", item_type="Feature Service")
for item in self.api_query_result:
layers = item.layers
for lyr in layers:
print(item)
try:
print(item.id, item.url, lyr.properties["id"], lyr.properties["name"])
except Exception as e:
print(e)
I can get all the layers including the layer WETTBEWERBER (0) in it.
But I cannot list all the feature service which contains this particular layer, What am I doing wrong ??
Thank you for the insights.