Select to view content in your preferred language

Using Jupyter Notebooks to search for all items that contain a specific feature service?

1822
10
04-04-2023 08:47 AM
DaveK
by
Occasional Contributor

Hello, 

I'm trying to create a Python script within Jupyter Notebooks that will allow me to search all publicly available items within ArcGIS online that contain a specific feature service. Here is the script I have so far. 

 

import arcgis
from arcgis.gis import GIS

# connect to ArcGIS Online
gis = GIS("https://www.arcgis.com")
feature_service_id = "FEATURE SERVICE ID"
print('connected to arcgis online')

# search for all publicly available feature services
web_maps = gis.content.search(query= feature_service_id, item_type = 'web map', outside_org=True, max_items = 200)
print('Found public items')

# print the titles of the feature services
for item in web_maps:
    print('NAME: ' + item.title,'OWNER: ' + item.owner)
print('completed')

 

I cant seem to figure out how to return the webmaps that contain the feature service specified. Any help is appreciated. 

Thanks.

0 Kudos
10 Replies
David_McRitchie
Esri Contributor

Hey Dave,

Does adding display (web_maps) to the end of your code return the desired result?

Esri UK -Technical Support Analyst
0 Kudos