I need to be able to move one or more features based on an angle and distance offset. I'm not sure how to approach this. The Edit toolbar allows for moving one feature through mouse interaction, which does not match my workflow. Is there a tool in the geometryEngine that supports this operation? Is there a method on the Geometry class? Ideally the solution is client side but I could support an async operation on the server.
User Story: User can nudge (move a small distance in a set direction) one or many features based on button click or keyboard input
Thanks!
Solved! Go to Solution.
I've created a module to provide this functionality. It takes a geometry, distance (meters), and angle and returns a new geometry at that offset. To move lines and polygons it moves each vertex by the offset amount. It works, but I haven't created any unit tests to check all scenarios , so use at your own risk. Attached is the AMD module.
You could use the offset method in the GeometryEngine to achieve this.
esri/geometry/geometryEngine | API Reference | ArcGIS API for JavaScript 3.19
This would work for points but not polygons. For a polygon the offset method is similar to the buffer tool, returning a geometry that is inside or surrounding the original feature by the offset amount.
I think it will work for both point and polyline, if the problem is only for polygon, then you can loop through all the points within the polygon and offset them.
I've created a module to provide this functionality. It takes a geometry, distance (meters), and angle and returns a new geometry at that offset. To move lines and polygons it moves each vertex by the offset amount. It works, but I haven't created any unit tests to check all scenarios , so use at your own risk. Attached is the AMD module.
Could you please let me know how can we identify the distance(meters) and angle to use your module. My workflow is like user moves it on map. So, how do we get the distance (meters) and angle.
Any information/help would be highly appreciated.
Thanks in advace!
With Regards,
Vara Prasad