public static ICoordinate GetCoordinate(this OSGeo.OGR.Geometry geometry, int index) { ICoordinate coordinate = null; if (geometry != null) { if (index >= 0 && index < geometry.GetPointCount()) { int dimension = geometry.GetCoordinateDimension(); double[] buffer = new double[dimension]; switch (dimension) { case 2: geometry.GetPoint_2D(index, buffer); break; case 3: geometry.GetPoint(index, buffer); break; case 4: geometry.GetPointZM(index, buffer); break; } coordinate = new Coordinate(buffer); } } return(coordinate); }