private CoordinateSequence fromCoordinateArray(Coordinate[] coordinates, DimensionalFlag dim) { PointSequenceBuilder builder = PointSequenceBuilders.fixedSized(coordinates.length, dim); double[] ordinates = new double[dim.getCoordinateDimension()]; for (Coordinate co : coordinates) { copy(co, ordinates, dim); builder.add(ordinates); } return (CoordinateSequence) builder.toPointSequence(); }