Can the JavaScript API Change Records in a Feature Layer

355
2
05-15-2022 07:58 PM
raydeen
New Contributor II

I have a feature layer which I populated by manually uploading and managing data from a CSV file within the ArcGIS Developer UI. Periodically, the data changes. New records need adding, or lat/long coords change. As such, I'd like to use the JavaScript API to treat this feature layer like a conventional database table.

Is there a way to insert, update, and delete records in the feature layer? I see the FeatureLayer.addEdits() method but that doesn't seem to do the trick. However, here's kind of the idea. 

https://totalapis.github.io/sample-code/sandbox/index.html?sample=editing-applyedits

This sandbox example supposedly allows a user to add, edit or delete an item on a feature layer. The example  doesn't work for me, but the concept is there. The difference for me is that the user would not be able to change any data, only an application process. 

0 Kudos
2 Replies
JeffreyWilkerson
Occasional Contributor III

I'm not sure what you are trying to do, exactly, but whether it's a user that triggers the featurelayer.applyEdits or an application process, the tool or function (applyEdits) would still be the same (or maybe calling the addFeatures/updateFeatures directly on the REST service - https://developers.arcgis.com/rest/services-reference/enterprise/update-features.htm ).  If you are looking for ideas on how to call an edit function from a process, please provide more information on what that process looks like.

 

0 Kudos
raydeen
New Contributor II

Thanks for your reply. I maintain a system whereby users enter one or more project requests on a form, whose data is entered into a database upon submission.

As part of the submission we use a third party to acquire the lat/long coordinates of the project address and store that in the database, too. To complete the submission, I'd like to use an ArcGIS API, be it JavaScript, REST, Python, etc., to append this new record, along with lat/long coordinates to a specific feature layer. 

The feature layer, when shown on a map, with all its data points, is now current and reflects the newly entered project request. I hope that covers what you were looking for. Let me know if you need more technical specs. Thanks again. 

0 Kudos