Hello friends:
My question is: In the Python API, how do I get a collection of Operational Layers given a QuickCapture Project obtained in a query.
The objective is to do something with each operational layer in a QuickCapture Project Here is some code:
myQCs = gis.content.search(query="type: 'QuickCapture Project'", max_items=1000) # "QuickCapture Project" guarantees a QC Project
for aQC in myQCs:
qcProjectItem = gis.content.get(aQC.id)
As you can see, I can get the QuickCapture Project as a Python object. I am hoping I can use this object to obtain the operational layers. Unfortunately this is as far as the breadcrumbs lead.
Notably: '
qcProjectItem.get_data()
returns an empty object {}.
Here's hoping you can help.
Solved! Go to Solution.
Try out the following. Note: This was performed in a Notebook in ArcGIS Pro 3.2, with API version 2.2.0.1.
from arcgis.gis import GIS
import json
## connect to agol
agol = GIS("home")
## get QC item
qcap_item = agol.content.get("ITEM_ID")
## You dont need to run this but look for qc.project.json file in list returned.
for resource in qcap_item.resources.list():
print(resource)
## get json
qcap_json = qcap_item.resources.get("qc.project.json")
## print json
print(json.dumps(qcap_json, indent=4))
## or just get dataSources
print(json.dumps(qcap_json["dataSources"], indent=4))
Try out the following. Note: This was performed in a Notebook in ArcGIS Pro 3.2, with API version 2.2.0.1.
from arcgis.gis import GIS
import json
## connect to agol
agol = GIS("home")
## get QC item
qcap_item = agol.content.get("ITEM_ID")
## You dont need to run this but look for qc.project.json file in list returned.
for resource in qcap_item.resources.list():
print(resource)
## get json
qcap_json = qcap_item.resources.get("qc.project.json")
## print json
print(json.dumps(qcap_json, indent=4))
## or just get dataSources
print(json.dumps(qcap_json["dataSources"], indent=4))
My friend, you have been saving me a lot of work lately! Thank you so much.