public static void SetCoordinate(this OSGeo.OGR.Geometry geometry, int index, ICoordinate coordinate) { if (geometry != null && coordinate != null) { if (index >= 0 && index < geometry.GetPointCount()) { int dimension = geometry.GetCoordinateDimension(); switch (dimension) { case 2: geometry.SetPoint_2D(index, coordinate.X, coordinate.Y); break; case 3: geometry.SetPoint(index, coordinate.X, coordinate.Y, coordinate.Z); break; case 4: geometry.SetPointZM(index, coordinate.X, coordinate.Y, coordinate.Z, coordinate.M); break; } } } }