toLineString static method

String toLineString(
  1. List<Coordinate> coord
)

Generates the WKT for a LINESTRING specified by a {@link CoordinateSequence}.

@param coord the sequence to write

@return the WKT string

Implementation

static String toLineString(List<Coordinate> coord) {
  StringBuffer buf = StringBuffer();
  buf.write("LINESTRING ");
  if (coord.length == 0)
    buf.write(" EMPTY");
  else {
    buf.write("(");
    for (int i = 0; i < coord.length; i++) {
      if (i > 0) buf.write(", ");
      buf.write(coord[i].x);
      buf.write(" ");
      buf.write(coord[i].y);
    }
    buf.write(")");
  }
  return buf.toString();
}