private Coordinate[] toCoordList(
      String rawTextValue,
      final String decimalSeparator,
      final String coordSeparator,
      final String tupleSeparator,
      final int dimension,
      CoordinateReferenceSystem crs) {

    rawTextValue = rawTextValue.replaceAll("[\n\r]", " ").trim();

    String[] tuples = rawTextValue.split("\\" + tupleSeparator + "+");

    final int nCoords = tuples.length;

    Coordinate[] coords = new Coordinate[nCoords];
    Coordinate coord;

    boolean invertXY = WFSConfig.invertAxisNeeded(axisOrder, crs);

    double x, y, z;

    for (int i = 0; i < nCoords; i++) {
      String tuple = tuples[i];
      String[] oridnates = tuple.split("\\" + coordSeparator + "+");
      double[] parsedOrdinates = new double[oridnates.length];
      for (int o = 0; o < oridnates.length; o++) {
        String ordinate = oridnates[o];
        if (!".".equals(decimalSeparator)) {
          String[] split = ordinate.split("\\" + decimalSeparator);
          ordinate = new StringBuilder(split[0]).append('.').append(split[1]).toString();
        }
        parsedOrdinates[o] = Double.parseDouble(ordinate);
      }

      x = parsedOrdinates[0];
      y = parsedOrdinates[1];
      if (dimension > 2 && parsedOrdinates.length > 2) {
        z = parsedOrdinates[2];
        if (invertXY) {
          coord = new Coordinate(y, x, z);
        } else {
          coord = new Coordinate(x, y, z);
        }
      } else {
        if (invertXY) {
          coord = new Coordinate(y, x);
        } else {
          coord = new Coordinate(x, y);
        }
      }
      coords[i] = coord;
    }
    return coords;
  }
 private Coordinate[] toCoordList(
     String rawTextValue, final int dimension, CoordinateReferenceSystem crs) {
   rawTextValue = rawTextValue.trim();
   rawTextValue = rawTextValue.replaceAll("\n", " ");
   rawTextValue = rawTextValue.replaceAll("\r", " ");
   String[] split = rawTextValue.trim().split(" +");
   final int ordinatesLength = split.length;
   if (ordinatesLength % dimension != 0) {
     throw new IllegalArgumentException(
         "Number of ordinates ("
             + ordinatesLength
             + ") does not match crs dimension: "
             + dimension);
   }
   boolean invertXY = WFSConfig.invertAxisNeeded(axisOrder, crs);
   final int nCoords = ordinatesLength / dimension;
   Coordinate[] coords = new Coordinate[nCoords];
   Coordinate coord;
   int currCoordIdx = 0;
   double x, y, z;
   for (int i = 0; i < ordinatesLength; i += dimension) {
     x = Double.valueOf(split[i]);
     y = Double.valueOf(split[i + 1]);
     if (dimension > 2) {
       z = Double.valueOf(split[i + 2]);
       if (invertXY) {
         coord = new Coordinate(y, x, z);
       } else {
         coord = new Coordinate(x, y, z);
       }
     } else {
       if (invertXY) {
         coord = new Coordinate(y, x);
       } else {
         coord = new Coordinate(x, y);
       }
     }
     coords[currCoordIdx] = coord;
     currCoordIdx++;
   }
   return coords;
 }