How move an existing point on a layer?

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.

Judging by the documentation should work like this:

ShapeG.set_Point(0,MoveToPoint);

but it does not work! Something’s missing!

Try using the EditUpdateShape 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: ?

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

Thanks so much. Now works, so as need! :+1::+1::+1:

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