Last active
April 26, 2019 21:16
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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