2

I've so far been able to add a feature layer from an ArcGIS server, and I've also been able to add an editor widget which allows me to draw to feature with the mouse. The added features are being correctly committed to the server, and are visible from other viewers as well as in the SDE database. I have also been able to add the Editor toolbar and edit the existing polygon features.

However, I'm now looking for a way to add a feature without using the widget, just using JavaScript code. The closest thing I found was http://forums.esri.com/Thread.asp?c=206&f=2274&t=271592 but it discusses .NET and doesn't look similar to the way something like that would be achieved in Javascript. Where would the best starting point be for doing something like this?

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Jan 27, 2015 at 16:05
1

1 Answer 1

4

I think what you're trying to do would use a combo of the Draw tool and the FeatureLayer applyEdits method. This sample kind of gets you started, but the workflow is use Draw tool, on draw-end event, add drawn graphic using applyEdits method of FeatureLayer. I don't have a solid example on hand, but here is a simple-edit-widget and sample code from my book.

If you wanted to do it all via non-esri JS code, you'll need to get familiar with the ArcGIS REST API, particularly the applyEdits endpoint of a Feature Service.

Hope that helps.

answered Jan 27, 2015 at 16:28
1
  • 1
    +1 The majority of the API and ArcGIS Online are underpinned by the rest API so pretty much anything realistic should be possible with it. Commented Jan 27, 2015 at 22:44

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.