Check to see if feature is hosted

288
1
Jump to solution
02-16-2022 11:06 AM
AlfredBaldenweck
MVP Regular Contributor

Hi all, 

I have a quick question this time:

How can you check if something is a hosted feature using python?

Use case: my script only works on local Feature Classes, and will throw an error if you use a hosted feature. I would like to check that it's not hosted so it can be skipped if it is hosted.

 

Thanks!

0 Kudos
1 Solution

Accepted Solutions
DonMorrison1
Occasional Contributor III

If you do a Describe on the feature class, a hosted feature catalog path should start with 'https'.

fc = 'https://services2.arcgis.com/dJOijx2lWTlGQBDJ/arcgis/rest/services/CW_3872/FeatureServer'

arcpy.Describe(fc).catalogPath
'https://services2.arcgis.com/dJOijx2lWTlGQBDJ/arcgis/rest/services/CW_3872/FeatureServer'

 

View solution in original post

1 Reply
DonMorrison1
Occasional Contributor III

If you do a Describe on the feature class, a hosted feature catalog path should start with 'https'.

fc = 'https://services2.arcgis.com/dJOijx2lWTlGQBDJ/arcgis/rest/services/CW_3872/FeatureServer'

arcpy.Describe(fc).catalogPath
'https://services2.arcgis.com/dJOijx2lWTlGQBDJ/arcgis/rest/services/CW_3872/FeatureServer'