toText method

  1. @override
String toText({
  1. TextWriterFormat<SimpleGeometryContent> format = GeoJSON.geometry,
  2. int? decimals,
  3. CoordRefSys? crs,
  4. Map<String, dynamic>? options,
})
override

The string representation of this geometry object, with format applied.

When format is not given, then the geometry format of GeoJSON is used as a default.

Use decimals to set a number of decimals (not applied if no decimals).

Use crs to give hints (like axis order, and whether x and y must be swapped when writing) about coordinate reference system in text output. When data itself have CRS information it overrides this value.

Other format or encoder implementation specific options can be set by options.

Implementation

@override
String toText({
  TextWriterFormat<SimpleGeometryContent> format = GeoJSON.geometry,
  int? decimals,
  CoordRefSys? crs,
  Map<String, dynamic>? options,
}) {
  final encoder =
      format.encoder(decimals: decimals, crs: crs, options: options);
  writeTo(encoder.writer);
  return encoder.toText();
}