readGeometryTaggedText method

Geometry? readGeometryTaggedText(
  1. WKTTokenizer tokenizer
)

Creates a Geometry using the next token in the stream.

@return a Geometry specified by the next token in the stream @throws ParseException if the coordinates used to create a Polygon shell and holes do not form closed linestrings, or if an unexpected token was encountered @throws IOException if an I/O error occurs @param tokenizer tokenizer over a stream of text in Well-known Text

Implementation

Geometry? readGeometryTaggedText(WKTTokenizer tokenizer) {
  String type;

  List<Ordinate> ordinateFlags = List.from([Ordinate.X, Ordinate.Y]);
  try {
    type = getNextWord(tokenizer).toUpperCase();
    if (type.endsWith("ZM")) {
      ordinateFlags.add(Ordinate.Z);
      ordinateFlags.add(Ordinate.M);
    } else if (type.endsWith("Z")) {
      ordinateFlags.add(Ordinate.Z);
    } else if (type.endsWith("M")) {
      ordinateFlags.add(Ordinate.M);
    }
  } catch (e) {
    return null;
  }

  return readGeometryTaggedTextWithOpts(tokenizer, type, ordinateFlags);
}