What looked like a simple task has kept me busy for a while now. I would like to snap the endpoint of a polyline feature to a known point of which I know the coordinates.

My first try was the following (within an edit operation):

polyline = feature.ShapeCopy as IPolyline;
polyline.ToPoint.PutCoords(_connectionPoint.X, _connectionPoint.Y);
feature.Shape = polyline;

the new coordinates however would never be saved at the feature.

I also looked at this example:


but I am a bit confused about whether I really need a HitTest in my case.

2 Answers 2


You need to update the specific point coordinates via IPointCollection.Update.


I think I just found a solution myself. I was already close. As stated above ToPoint.PutCoords doesn't work. But I could use this:

polyline = feature.ShapeCopy as IPolyline;
polyline.ToPoint = _connectionPoint
feature.Shape = polyline as IGeometry;

maybe this is helpful for others looking for a simple way how to edit a polyline (end)vertex.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.