Hello,
I am trying to partially reuse the example described in this sample:
https://developers.arcgis.com/javascript/latest/sample-code/layers-featurelayer-collection-edits/
But using a GeoJSONlayer instead of a FeatureLayer.
In the code snippet below, the "geojson" variable is just a geojson object that contain 25 features (points).
When using featurelayer.applyEdits(), it plots all the points on the map.
While using geojsonlayer.applyEdits(), it just plots either 1 point, sometimes 2 points.
When inspecting the "console.log(editsResult)" in both cases 25 items have been added ("editsResult.addFeatureResults" property), but with geojsonlayer the objectids are the same
Any idea why this happens?
Thanks!
for (feature of geojson.features){
let point = {
type: "point",
longitude: feature.geometry.coordinates[0],
latitude: feature.geometry.coordinates[1]
}
let pointGraphic = new Graphic({
geometry: point
})
addFeatures.push(pointGraphic)
}
geojsonlayer.applyEdits({
addFeatures:addFeatures
}).then((editsResult) => {
console.log(editsResult)
})
console.log(editResults):
{
"addFeatureResults": [
{
"objectId": "__OBJECTID-17f26c9a7de",
"globalId": null,
"error": null
},
{
"objectId": "__OBJECTID-17f26c9a7de",
"globalId": null,
"error": null
},
{
"objectId": "__OBJECTID-17f26c9a7de",
"globalId": null,
"error": null
},
{
"objectId": "__OBJECTID-17f26c9a7de",
"globalId": null,
"error": null
},
{
"objectId": "__OBJECTID-17f26c9a7de",
"globalId": null,
"error": null
},
{
"objectId": "__OBJECTID-17f26c9a7de",
"globalId": null,
"error": null
},
{
"objectId": "__OBJECTID-17f26c9a7de",
"globalId": null,
"error": null
},
{
"objectId": "__OBJECTID-17f26c9a7de",
"globalId": null,
"error": null
},
{
"objectId": "__OBJECTID-17f26c9a7de",
"globalId": null,
"error": null
},
{
"objectId": "__OBJECTID-17f26c9a7de",
"globalId": null,
"error": null
},
{
"objectId": "__OBJECTID-17f26c9a7de",
"globalId": null,
"error": null
},
{
"objectId": "__OBJECTID-17f26c9a7de",
"globalId": null,
"error": null
},
{
"objectId": "__OBJECTID-17f26c9a7de",
"globalId": null,
"error": null
},
{
"objectId": "__OBJECTID-17f26c9a7de",
"globalId": null,
"error": null
},
{
"objectId": "__OBJECTID-17f26c9a7de",
"globalId": null,
"error": null
},
{
"objectId": "__OBJECTID-17f26c9a7de",
"globalId": null,
"error": null
},
{
"objectId": "__OBJECTID-17f26c9a7de",
"globalId": null,
"error": null
},
{
"objectId": "__OBJECTID-17f26c9a7de",
"globalId": null,
"error": null
},
{
"objectId": "__OBJECTID-17f26c9a7de",
"globalId": null,
"error": null
},
{
"objectId": "__OBJECTID-17f26c9a7de",
"globalId": null,
"error": null
},
{
"objectId": "__OBJECTID-17f26c9a7de",
"globalId": null,
"error": null
},
{
"objectId": "__OBJECTID-17f26c9a7de",
"globalId": null,
"error": null
},
{
"objectId": "__OBJECTID-17f26c9a7de",
"globalId": null,
"error": null
},
{
"objectId": "__OBJECTID-17f26c9a7de",
"globalId": null,
"error": null
},
{
"objectId": "__OBJECTID-17f26c9a7de",
"globalId": null,
"error": null
}
],
"updateFeatureResults": [],
"deleteFeatureResults": [],
"addAttachmentResults": [],
"updateAttachmentResults": [],
"deleteAttachmentResults": []
}