toEwkt method

  1. @override
String toEwkt()
override

Returns the EWKT representation for PostGIS, e.g. SRID=4326;POINT(-0.12 51.5).

Implementation

@override
String toEwkt() {
  // Sub-geometries are written without their SRID prefix (the collection
  // carries the single SRID).
  final inner = geometries
      .map((g) => g.toEwkt().replaceFirst(RegExp(r'SRID=\d+;'), ''))
      .join(', ');
  return 'SRID=$srid;GEOMETRYCOLLECTION($inner)';
}