How to edit Feature position on map by draging?

742 views arcgis

I need to move a feature position on a map, by dragging it on the map.

When using the map server, I'm able to do that, but I can't implement that on my HTML Map. Couldn't find anything related to this on the documentation or searching for questions.


answered question

1 Answer


Suppose your features are Graphic objects.

  1. Add a mousedown and a mouseup event listeners to the map
  2. On map mousedown, verify if a feature intersect with a circle centered at the mousedown position (you will have to convert pixel to map units here);
  3. If there is a drawing feature, add a map mousemove event listener
  4. On map mousemove, modify the geometry of the feature with the position of the cursor (that will be easy for point feature, but more complex for polyline and polygon)

  5. On map mouseup, remove the mousemove event listener

posted this

Have an answer?


Please login first before posting an answer.