Hello!
My environment is ArcGIS Enterprise v11.1 & ArcGIS Pro v3.2.1.
I can successfully append from a shapefile to a hosted feature layer in Portal. The new points come over, but the attributes are blank.
# initial imports
from IPython.display import display, HTML
from arcgis.features import FeatureLayerCollection
from arcgis.gis import GIS
import pandas as pd
# connect to GIS
gis = GIS("home")
# set a variable for the source .shp
src_table = r"C:\Data\orbs.shp"
# Read the shapefile using Spatially Enabled DataFrame
sdf = pd.DataFrame.spatial.from_featureclass(src_table)
sdf
# Get the item to append to (target)
item = gis.content.get("07bbd53a0efu413193fcb511c6dcb4d5")
flayer = item.layers[0] # first item in the FeatureLayerCollection
item
# confirming the first item in the collection
print(flayer)
# append
flayer.edit_features(adds = sdf)
Any assistance you can provide is greatly appreciated!
Solved! Go to Solution.
I have better better luck converting the dataframe to a featureset first. Try this for your final line:
flayer.edit_features(adds = sdf.spatial.to_featureset())
I have better better luck converting the dataframe to a featureset first. Try this for your final line:
flayer.edit_features(adds = sdf.spatial.to_featureset())
This worked! Thank you for your time!