I am trying to update point geometry from an outside data set. I can update all the other data and can successfully create new points with the correct geometry but when I try to update the geometry of an existing point the data layer does not update its location. The pre and post geometry tags are updated correctly but when I requery the point it still has the old geometry.
gwp_content = gis.content.get('########################')
gwp_layer = gwp_content.layers[0]
assets_f = assets.query("AssetID == 'B1610'")
for a in assets_f.itertuples():
# for a in assets.itertuples():
try:
gwp_fset = gwp_layer.query(where="AssetID='" + a.Index + "'")
f_count = len(gwp_fset.features)
if f_count > 0:
gwp_f = gwp_fset.features[0]
# print("Pre", a)
print("Pre gwp_f", gwp_f)
# print(a.Index)
gwp_f.set_value("End_Date",time_end)
gwp_f.set_value("CreatedBy",a.CreatedBy)
gwp_f.set_value("ModifiedBy",a.ModifiedBy)
gwp_f.set_value("Title",a.title)
gwp_f.set_value("AssetSubType",a.AssetSubType)
gwp_f.set_value("RMID",a.RMID)
gwp_f.set_value("Latitude",a.Latitude)
gwp_f.set_value("Longitude",a.Longitude)
gwp_f.set_value("POINT_X",a.POINT_X)
gwp_f.set_value("POINT_Y",a.POINT_Y)
gwp_f.set_value("UTMX",a.UTMX)
gwp_f.set_value("UTMY",a.UTMY)
gwp_f.set_value("UTMZone",a.UTMZone)
gwp_f.set_value("UTMDatum",a.UTMDatum)
new_geometry = {"x":a.POINT_X, "y":a.POINT_Y}
spatial_reference = gwp_fset.spatial_reference
output_geometry = geometry.project(geometries=[new_geometry],in_sr=4326,out_sr=spatial_reference,gis=gis)
gwp_f.geometry = output_geometry
# gwp_f.set_value("geometry",{"x":a.POINT_X, "y":a.POINT_Y, "spatialReference" : {"wkid": 102100, "latestWkid": 3857}})
update_result = gwp_layer.edit_features(updates=[gwp_f])
print("Geo:", gwp_f.geometry)
print("Post gwp_f", gwp_f)
# print("Update Result:",update_result)
Any help would be appreciated. I have spent way too many hours scouring the forums.