Skip to content

Instantly share code, notes, and snippets.

@nommuna2
Last active April 26, 2019 21:16
Show Gist options
  • Save nommuna2/8bca695fd5456208f23a1daacc8c6697 to your computer and use it in GitHub Desktop.
Save nommuna2/8bca695fd5456208f23a1daacc8c6697 to your computer and use it in GitHub Desktop.
(ArcGIS API for Python) Sample of turning a feature set to a feature collection using python api
import arcgis
from arcgis.gis import GIS
try:
gis = GIS(None,"USERNAME", "PASSWORD", verify_cert=False)
featureLayer = gis.content.get('ID')
# A Query operation returns a FeatureSet (https://esri.github.io/arcgis-python-api/apidoc/html/arcgis.features.toc.html?highlight=query#featureset)
featureSet = featureLayer.layers[0].query(where="1=1", out_fields="*")
#Use the featureSet to make a featureCollection
featureCollection = arcgis.features.FeatureCollection.from_featureset(featureSet)
print(featureCollection)
except Exception as e:
print(e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment