# How move an existing point on a layer?

**URL:** <https://mapwindow.discourse.group/t/how-move-an-existing-point-on-a-layer/141>\
**Category:** MapWinGIS\
**Created:** [April 17, 2019, 9:33am UTC](https://mapwindow.discourse.group/t/how-move-an-existing-point-on-a-layer/141 "2019-04-17T09:33:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mainxt](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/mainxt/32/33_2.png) [@mainxt](https://mapwindow.discourse.group/u/mainxt)\
**Post date:** [April 17, 2019, 9:33am UTC](https://mapwindow.discourse.group/t/how-move-an-existing-point-on-a-layer/141/1 "2019-04-17T09:33:45Z")

</div>

How to do it properly? Create new point I have is obtained. But to move to other coordinates already exists… unable. Here’s my code:

```
var
  cBack: ICallback;

  var GLayer: IShapefile := EzMap.Shapefile[GHandle];
  var ShapeG: IShape := GLayer.Shape[MwShapeId];

var MoveToPoint: IPoint := CoPoint.Create;
      MoveToPoint.x := xy[0];
      MoveToPoint.y := xy[1];

  GLayer.StartEditingShapes(True, cBack);
  ShapeG.Point[0] := MoveToPoint;
  GLayer.StopEditingShapes(True, True, cBack);

```

But something is clearly missing. The point remains in place.

---

<div class="post-metadata">

**Author:** ![mainxt](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/mainxt/32/33_2.png) [@mainxt](https://mapwindow.discourse.group/u/mainxt)\
**Post date:** [April 17, 2019, 4:16pm UTC](https://mapwindow.discourse.group/t/how-move-an-existing-point-on-a-layer/141/2 "2019-04-17T16:16:46Z")

</div>

Judging by the documentation should work like this:

`ShapeG.set_Point(0,MoveToPoint);`

but it does not work! Something’s missing!

---

<div class="post-metadata">

**Author:** ![jerryfaust](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/jerryfaust/32/378_2.png) [@jerryfaust](https://mapwindow.discourse.group/u/jerryfaust)\
**Post date:** [April 17, 2019, 8:45pm UTC](https://mapwindow.discourse.group/t/how-move-an-existing-point-on-a-layer/141/3 "2019-04-17T20:45:50Z")

</div>

Try using the [EditUpdateShape](https://www.mapwindow.org/documentation/mapwingis4.9/group __shapefile__ editing.html#ga376cc8f85013136546863c837379c95b) call, to specifically set the Shape before saving edits. I think that you’re only editing the in-memory ShapeG variable, and not actually updating the Shapefile. Something like: ?

```auto
  GLayer.StartEditingShapes(True, cBack);
  ShapeG.Point[0] := MoveToPoint;
  GLayer.EditUpdateShape(MwShapeId, ShapeG);
  GidrantsLayer.StopEditingShapes(True, True, cBack);

```

---

<div class="post-metadata">

**Author:** ![mainxt](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/mainxt/32/33_2.png) [@mainxt](https://mapwindow.discourse.group/u/mainxt)\
**Post date:** [April 18, 2019, 5:02am UTC](https://mapwindow.discourse.group/t/how-move-an-existing-point-on-a-layer/141/4 "2019-04-18T05:02:20Z")

</div>

Thanks so much. Now works, so as need! 👍👍👍

---

<div class="post-metadata">

**Author:** ![pmeems](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/pmeems/32/9_2.png) [@pmeems](https://mapwindow.discourse.group/u/pmeems)\
**Post date:** [April 22, 2019, 4:00pm UTC](https://mapwindow.discourse.group/t/how-move-an-existing-point-on-a-layer/141/5 "2019-04-22T16:00:03Z")

</div>

Closed on April 22, 2019, 4:00pm UTC

This topic was automatically closed after 4 days. New replies are no longer allowed.
