GeoBounds<T extends GeoPoint>.parse constructor

GeoBounds<T extends GeoPoint>.parse(
  1. String text,
  2. PointFactory<T> pointFactory, {
  3. ParseCoordsList? parser,
})

Geographic bounds parsed from text with two points.

If parser is null, then WKT text like "25.1 53.1, 25.2 53.2" is expected.

Implementation

factory GeoBounds.parse(
  String text,
  PointFactory<T> pointFactory, {
  ParseCoordsList? parser,
}) {
  if (parser != null) {
    final coordsList = parser.call(text);
    return GeoBounds<T>.make(coordsList, pointFactory);
  } else {
    final points = parseWktPointSeries(text, pointFactory);
    return GeoBounds<T>.of(min: points[0], max: points[1]);
  }
}