Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

add a new field to a Hosted Feature Layer

from arcgis.gis import GIS
from arcgis import features
from arcgis.features import FeatureLayer
from arcgis.features import FeatureLayerCollection
arcpy.env.overwriteOutput = True
gis = GIS("https://ausbats.maps.arcgis.com", "<USERNAME>", "<PASSWORD>") 
bat_url = "https://services5.arcgis.com/wkEdAXzuNvKdAtLV/arcgis/rest/services/Hipposideros_ater_X/FeatureServer/0"
bat_fl = FeatureLayer(bat_url,gis)
new_field = {
    "name": "Taxon",
    "type": "esriFieldTypeString",
    "alias": "Taxon",
    "length": 30,
    "nullable": True,
    "editable": True,
    "visible": True,
    "domain": None
}
update_dict = {"fields": [new_field]}
bat_fl.manager.add_to_definition(update_dict)
Source by community.esri.com #
 
PREVIOUS NEXT
Tagged: #add #field #Hosted #Feature #Layer
ADD COMMENT
Topic
Name
9+8 =