Move a polygon feature by using ArcGIS runtime SDK for .Net

222
6
10-16-2019 06:41 AM
Highlighted
Occasional Contributor

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.

Tags (1)
Reply
0 Kudos
6 Replies
Highlighted
MVP Regular Contributor

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.

Reply
0 Kudos
Highlighted
Esri Frequent Contributor

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).

Reply
0 Kudos
Highlighted
Occasional Contributor

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.

Reply
0 Kudos
Highlighted
Esri Frequent Contributor

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?

Reply
0 Kudos
Highlighted
Occasional Contributor

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.

Reply
0 Kudos
Highlighted
Esri Frequent Contributor

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.

Reply
0 Kudos