Last active
April 26, 2019 21:04
-
-
Save nommuna2/78d1dbf9b45755636b057c8b2b010359 to your computer and use it in GitHub Desktop.
(ArcGIS API for Python) Sample of exporting a Feature layer to a file GeoDatabase 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 | |
import json | |
from arcgis.gis import GIS | |
from arcgis.features import FeatureLayerCollection | |
# Log into AGOL account [admin level] | |
gis = GIS(None,'username', 'password', verify_cert=False) | |
# Grab the feature layer item by id | |
featureLayerItem = gis.content.get('feature layer id') | |
params = { | |
'layers': [ | |
{'id': 0, 'where': "STATE_NAME = 'Washington'"} | |
] | |
} | |
try: | |
geoDbItem = featureLayerItem.export('StatesFL4','File Geodatabase', params) | |
geoDbItem.download(r'path to file') | |
print(geoDbItem) | |
except Exception as e: | |
print(e) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment