Hi all,
I'm trying to replicate the code published by ESRI in https://developers.arcgis.com/python/sample-notebooks/updating-features-in-a-feature-layer/ . In the link example, they use point geometry, but in my case I’m trying to update polygon geometry. I have updated the code to work with polygon geometry but I’m receiving the following error "None of [Index([('SHAPE',)], dtype='object')] are in the [columns]", which is related to the input geometry line in my code.
my code is
# complete the updates
from arcgis import geometry #use geometry module to project the records
from copy import deepcopy
for cr_id in overlap_rows['cr_id']:
# get the feature to be updated
original_feature = [f for f in all_features if f.attributes['cr_id'] == cr_id][0]
feature_to_be_updated = deepcopy(original_feature)
print(str(original_feature))
# get the matching row from the update layer ()
matching_row = CRID_New_ly_FS2.where(CRID_New_ly_FS2.cr_id == cr_id).dropna()
#get geometries in the destination coordinate system
input_geometry = {'rings': float(matching_row[[['SHAPE']]])}
output_geometry = geometry.project(geometries = [input_geometry],
in_sr = CRID_Old_FS.spatial_reference['wkid'],
out_sr = CRID_Old_FS.spatial_reference['latestWkid'],
gis = gis1)
# assign the updated values
feature_to_be_updated.geometry = output_geometry[0]
feature_to_be_updated.attributes['cr_id'] = int(matching_row['cr_id'])
feature_to_be_updated.attributes['C31013'] = matching_row['C31013'].values[0]
feature_to_be_updated.attributes['big_shape'] = matching_row['big_shape'].values[0]
feature_to_be_updated.attributes['site_name'] = matching_row['site_name'].values[0]
feature_to_be_updated.attributes['awh_stage'] = int(matching_row['awh_stage'])
feature_to_be_updated.attributes['awh_package'] = int(matching_row['awh_package'])
# #add this to the list of features to be updated
features_for_update.append(feature_to_be_updated)
#
print(str(feature_to_be_updated))
print("========================================================================")
Any suggestions?
many thanks
Ash