Last active
April 26, 2019 20:22
-
-
Save nommuna2/d5bb4b02137eef2dc7af6c4a5975f180 to your computer and use it in GitHub Desktop.
(ArcGIS API for Python) Delete fields from a feature layer using the 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 | |
# Provide credentials to the GIS object. | |
gis = GIS(username="username", password= "password") | |
#Get the id of the hosted feature layer | |
item = gis.content.get("id of feature layer") | |
#Get the feature layer itself | |
fl = item.layers[0] | |
#This is the JSON structure you need to pass in so that it knows what field to delete. | |
# https://developers.arcgis.com/rest/services-reference/delete-from-definition-feature-layer-.htm | |
json = { | |
"fields" : [ | |
{ | |
"name" : "POP90_SQMI" | |
} | |
] | |
} | |
result = fl.manager.delete_from_definition(json) | |
print(result) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment