Hi all,
I am looking for a solution with which I can do fast coordinate updates of FeatureLayer objects hosted on ArcGIS Online. I guess with applyEdits() function I just can update "normal" attributes, but not the geometries/graphics information. A big amount of points has to be updated programmatically everytime. (Background: application provides a csv import with 5000-10000 datasets including new point coordinates). New points also have to be created, if dataset is not existing in hosted FeatureLayer yet.
How could I do this with good performance?
Best Regards,
Michael
Solved! Go to Solution.
Michael,
I guess with applyEdits() function I just can update "normal" attributes, but not the geometries/graphics information.
No that is not correct applyEdits is the way to update geometry and /or attributes for a editable layer.
https://developers.arcgis.com/javascript/3/jsapi/featurelayer-amd.html#applyedits
Michael,
I guess with applyEdits() function I just can update "normal" attributes, but not the geometries/graphics information.
No that is not correct applyEdits is the way to update geometry and /or attributes for a editable layer.
https://developers.arcgis.com/javascript/3/jsapi/featurelayer-amd.html#applyedits
Thank you very much, I work with JS API 4.6, but solved it anyway. Is this an efficient way to update thousands of features or do you know a faster way?
var feature = new Graphic({
geometry: {
type: "point",
longitude: 10.784112,
latitude: 48.124298
},
attributes: {FID: 3}
});
lyr.applyEdits({
updateFeatures: [feature]
});
Michael,
Are you recreating each graphic or just updating the existing graphics geometry?
I just want to push two coordinates into each dataset of an ArcGIS Online table ( = update each datasets' coordinates). If dataset with requested object id is not existing yet, a new dataset has to be created in that table. In most cases, datasets are updated and not have to be created newly
What you have in your previous post is good then as long as you are not doing a applyEdits for each feature. You only need one applyEdits unless you are going to batch the edits in smaller blocks.
I think I'm going to batch the edits in one block if that implies better performance. So what would be the syntax then? Like this?
var feature = new Graphic({
geometry: {
type: "point",
longitude: 10.784112,
latitude: 48.124298
},
attributes: {FID: 3}
});
var feature1 = new Graphic({
geometry: {
type: "point",
longitude: 11.784112,
latitude: 50.124298
},
attributes: {FID: 3}
});
var feature2.....
lyr.applyEdits({
updateFeatures: [feature, feature1, ...]
});
Yes. But this is how I would have the code (no need to create a var for each feature if you are only going to add it to an array and send to applyEdits):
var featArr = [];
featArr.push(new Graphic({
geometry: {
type: "point",
longitude: 10.784112,
latitude: 48.124298
},
attributes: {FID: 3}
}));
featArr.push(new Graphic({
geometry: {
type: "point",
longitude: 11.784112,
latitude: 50.124298
},
attributes: {FID: 4}
}));
lyr.applyEdits({
updateFeatures: featArr
});