AnsweredAssumed Answered

How to update a feature's geometry (Point)?

Question asked by kristof.victor on Apr 9, 2018
Latest reply on Apr 9, 2018 by kristof.victor

Hi there


I'm having way more trouble than I should have trying to update a feature's geometry (and sync it back to the database). Using Runtime v100, I retrieved the feature from the database like this:

QueryParameters {
    id: queryParams
    objectIds: [ app.user.OBJECTID ]
    returnGeometry: true

ServiceFeatureTable {

    onLoadStatusChanged: if( loadStatus === Enums.LoadStatusLoaded )
            queryFeatures( queryParams );

    onQueryFeaturesStatusChanged: if( queryFeaturesStatus === Enums.TaskStatusCompleted )
            root.userFeature = queryFeaturesResult.iterator.features[0];


Next, I want to update root.userFeature's geometry to the user's current location:


root.userFeature.geometry = mapView.locationDisplay.mapLocation;


I was able to write very similar code to update a feature's attachments and everything just synced magically to the database, so I suspect it's a SpatialReference issue, but I've tried projecting mapLocation to the service's spatial reference, WGS84, ... no luck. When I log app.user.geometry.json, it is the same as mapLocation's. I've tried to applyEdits() but nope. What am I missing here?


Also, Runtime v10 had GeodatabaseFeatureServiceTable.feature( objectid ) to get a specific feature by its OBJECTID. Does v100 have something similar? Couldn't find it in the docs, and the whole queryFeatures seems a bit overkill in my case (I know what the OBJECT ID of the feature I want to edit the geometry of, is).