Example of how to apply edit

3009
1
08-02-2013 08:31 AM
NathalieNeagle
New Contributor III
I've been looking at the Apply Edits (Operation) example in the help document.

I can take an example there and add a feature and update a feature -

http://help.arcgis.com/en/arcgisserver/10.0/apis/rest/

I can only add and update for the html.  I do this by going to the end point

http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/SanFrancisco/311Incidents/FeatureServer/0...

and dropping the appropriate code in the entry areas. 

If I switch to JSON I can also get the JSON to work



I'm hoping someone can help me with this:.

How do I push an update from my code.  Do you write everything in the url string
EXAMPLE - http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/SanFrancisco/311Incidents/FeatureServer/0... OR JSON **TO DO WORK***

Or do you somehow give the url in your code
http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/SanFrancisco/311Incidents/FeatureServer/0...
and then place your html or JSON in the appropriate input boxes -- "ADD, UPDATES, DELETES"

Can someone show me an example of this  - I'm writing in Silverlight but if the example was in JS or FLEX I'm sure I could figure it out.

I would like to push with JSON

An example would be great to show me, I should be able to study that example and learn from that and do it on my own.



THanks
Nathallie.
0 Kudos
1 Reply
AnttiKajanus1
Occasional Contributor III
Hi,

I know 2 source implementations that you can check. Depending on the scenario you have, you can use Dave Timmins implementation that you can find from https://github.com/davetimmins/ArcGIS.PCL. It is a portable class library that you can use to communicate with AGS / AGOL services without having reference to ESRI SKD. It is very nice implementation and you can use that also as a reference implementation if needed.

Another implementation is my Knet.ArcGIS library https://github.com/anttikajanus/knet-arcgis that is based on ESRI SDK and uses Graphic class to work with so it needs a reference to SDK. I'm now converting my older implementations to that repository but it is proceeding slowly. My implementation of Apply Edits is Task based approach with using Task Based Asynchronous Pattern. Current implementation is only WPF with 4.5 framework but I'm also creating same tasks for other platforms.

Example usage of EditFeaturesTask
 public async Task<EditFeaturesResult> SaveFeatures(List<Graphic> graphicsToAdd, List<Graphic> graphicsToUpdate)
        {
            var editFeaturesTask = new EditFeaturesTask(INCIDENT_SERVICE);
                    
            var editFeaturesParameter = new EditFeaturesParameter();
            if (graphicsToAdd.Count > 0)
            {
                editFeaturesParameter.AddGraphics.AddRange(graphicsToAdd);
            }
            if (graphicsToUpdate.Count > 0)
            {
                editFeaturesParameter.UpdateGraphics.AddRange(graphicsToUpdate);
            }


            var results = await editFeaturesTask.ExecuteAsync(editFeaturesParameter);
            return results;
        }
0 Kudos