Hi All,
I am using ArcGIS runtime SDK(version 100.6) for .Net. I want to move a polygon feature from one location to other. Kindly suggest me that how to achieve this.
To move something you just need to update the geometry of the existing feature
var feature = //somehow get existing feature
feature.Geometry = myNewGeometry;
await feature.FeatureTable.UpdateFeatureAsync(feature);
In terms of how one would actually allow a user to choose an existing polygon and allow the user to move that depends on many factors.
If you want to move it interactively, you can use the SketchEditor which supports dragging geometries around.
If you want to do it programmatically, you can use PolygonBuilder and iterate through the vertices and offset each vertex by a certain amount (this is actually what the SketchEditor does as you're dragging the feature around).
Hi Morten,
Thank for the response.
Iterating vertices will increase the execution time if the geometry has more number of vertices.
Without iterating through the vertices, is there any option like "ITransform2D method which is available in arcobjects"? So that we can move or rotate the geometry by using inbuilt functionality.
> Iterating vertices will increase the execution time if the geometry has more number of vertices.
Sure but it's still extremely quick. Any out-of-the-box method we could provide would have to do the same thing.
Are you seeing a performance issue?
In fact I am looking for the option like to move and rotate and scale. In ArcObjects, by using ITransform2D method we can do almost all these things. Hence I feel it would be useful, if we have the similar method in ArcGIS runtime also.
As mentioned, the SketchEditor has this ability built-in so users can interactively move, scale and rotate geometries.
To do it programmatically you'd just have to move each vertex yourself - there's no out-of-the-box capability for this.