Testappstudio

updateFeature not for geometry position?

Discussion created by Testappstudio on May 25, 2016
Latest reply on May 25, 2016 by paul.haakma

Hello,

i'd like to change the given position of a selected Feature to my GPS position. For testing i also changed some attribute values. After the update i can see the changes on my map until i restart the app but only the changes to the attributes are persistent.

 

I tried to replace the existing geometry with an new created from my GPS postion.

My second try was to use the setXY function of the geometry object with the projected GPS coordinates.

Both ways work on the screen/app but not the data behind (feature layer in arcgis online). Only the attribut values are updated.

 

Button{
  text: "Update"
  onClicked: {
    featureToEdit = featureLayer.featureTable.feature(hitFeatureId)
    if (featureToEdit) {
      var saveX = featureToEdit.geometry.x.toFixed(3)
      featureToEdit.geometry = posGPS.project(featureToEdit.geometry.spatialReference)
      var newX = featureToEdit.geometry.x.toFixed(3)
      featureToEdit.setAttributeValue("description",("old: " + saveX + "; new: " + newX))
      featureServiceTable.updateFeature(hitFeatureId, featureToEdit);
      featureServiceTable.applyFeatureEdits();
    }
  }
}

 

My workaround is to delete the original feature and place a copy on the new position.

Poor performance solution on refreshing the map to show the features again. (Only panning the map helps to redraw the features)

 

Maybe anyone can tell me how to update the position in the right way?

 

Best regards, Christian

Outcomes