1

Using ArcGIS Maps SDK for Javascript 4.28, is it possible to Move a feature in a featureLayer, without using the Editor widget?

The Editor widget has a mode whereby after Selecting a feature, when you mouse-over the feature the cursor changes to a cross-hair and you can drag and drop the feature to a new location. From the debugger Network tab it's apparent that this editing occurs in-memory on the client, and no changes are made until the Update button sends an updates request to the layer's ApplyEdits endpoint.

enter image description here

I would like to emulate this behaviour directly in the ArcGIS Maps SDK for JavaScript, without using the Editor widget.

That is, hovering over a feature should show the crosshairs cursor, and dragging the mouse button should move the feature (rather than the default of panning the map).

I can detect when the mouse is over a feature using hitTest on the view, but I can't figure out how to change the drag behaviour to move the feature rather than panning the map.

In addition to the Editor widget there is the Editor View Model and Edits class, and various Workflows which look promising - but the documentation for these is minimal.

Is it possible to enter the "Select feature" then "Move feature" modes programatically, without invoking the Editor widget?

3

1 Answer 1

1

You can move features without the Editor widget, using it's underlying "sketch" functionality. The Sketch widget provides a simple UI for creating and updating graphics, but in your case you're probably looking for the SketchViewModel which is the logic behind the Sketch widget UI.

See for example https://developers.arcgis.com/javascript/latest/sample-code/sketch-update-validation/

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.