Not able to edit feature service using ArcGIS Runtime for QT

530
3
Jump to solution
03-22-2020 06:40 AM
BrentSlone3
New Contributor III

Hi Team, 

I have been trying to access a feature service published on ArcGIS Server 10.6 using ServiceFeatureTable:

I am accessing the feature service as following: 

FeatureLayer {
      id:trackerFeatureLayer

      ServiceFeatureTable{
            id:trackingServiceFeatureTable
            url:"https://sampleserver6.arcgisonline.com/arcgis/rest/services/Wildfire/FeatureServer/0"
            // credential: Credential {
            // username: "ABC"
            // password: "XYZ"

            // }
            onApplyEditsStatusChanged: {
                  if (applyEditsStatus === Enums.TaskStatusCompleted) {
                  console.log("successfully updated feature");
            }
      }

}

Since ServiceFeatureTable inherits all the properties from FeatureTable I am trying to add a point to this feature service by using createFeature(), addFeature() and then applyEdits().

When I try using createFeature() it returns null, so I checked if the feature layer is editable or not and it returns fales.

console.log("checking if edits are permitted,",trackingServiceFeatureTable.canAdd())
console.log("checking if featurelayer is editable,",trackingServiceFeatureTable.editable)

var pointFeature = trackingServiceFeatureTable.createFeature();
console.log("checking pointFeature",pointFeature) 

Result:

qml: checking if edits are permitted, false

qml: checking if featurelayer is editable, false

qml: checking pointFeature null

Not sure what is wrong in the code, the sample service is public, tried adding credentials user1/user1 however that also fails.

0 Kudos
1 Solution

Accepted Solutions
BrentSlone3
New Contributor III

When you add the QMLFeatureLayer as a layer using

mapView.map.operationalLayers.append(featureLayerToBeAdded)

The editing capability are turned off.

In order to edit I added the QMLFeatureLayer in QMLMap and did not explicitly add it using the append() method. 

After added in QMLFeatureLayer in QMLMap I was able to edit the feature service:

Map{
id:map

BasemapTopographic{}
initialViewpoint: ViewpointCenter {
id:initialViewpoint
center: Point {
x: 11805395.771211328
y: 975123.3058248572
spatialReference: SpatialReference {wkid: 102100}
}
targetScale: 9e6
}

FeatureLayer {
id: featuretrackerLayer
ServiceFeatureTable {
id: featureTrackerTable
url: featureServerURL
}
}

}

View solution in original post

3 Replies
DanPatterson_Retired
MVP Emeritus

Can you go back and delete some of your duplicated posts

0 Kudos
BrentSlone3
New Contributor III

Thanks for notifing I was updating the post no idea why it created duplicates.

0 Kudos
BrentSlone3
New Contributor III

When you add the QMLFeatureLayer as a layer using

mapView.map.operationalLayers.append(featureLayerToBeAdded)

The editing capability are turned off.

In order to edit I added the QMLFeatureLayer in QMLMap and did not explicitly add it using the append() method. 

After added in QMLFeatureLayer in QMLMap I was able to edit the feature service:

Map{
id:map

BasemapTopographic{}
initialViewpoint: ViewpointCenter {
id:initialViewpoint
center: Point {
x: 11805395.771211328
y: 975123.3058248572
spatialReference: SpatialReference {wkid: 102100}
}
targetScale: 9e6
}

FeatureLayer {
id: featuretrackerLayer
ServiceFeatureTable {
id: featureTrackerTable
url: featureServerURL
}
}

}