Point.parse constructor

Point.parse(
  1. String text, {
  2. TextReaderFormat<SimpleGeometryContent> format = GeoJSON.geometry,
  3. CoordRefSys? crs,
  4. Map<String, dynamic>? options,
})

Parses a point geometry from text conforming to format.

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

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

Format or decoder implementation specific options can be set by options.

Examples:

// a point with a 2D position (x: 10.0, y: 20.0)
Point.parse(
  format: GeoJSON.geometry,
  '{"type": "Point", "coordinates": [10.0, 20.0]}',
);
Point.parse(
  format: WKT.geometry,
  'POINT (10.0 20.0)',
);

// a point with a 3D position (x: 10.0, y: 20.0, z: 30.0)
Point.parse(
  format: GeoJSON.geometry,
  '{"type": "Point", "coordinates": [10.0, 20.0, 30.0]}',
);
Point.parse(
  format: WKT.geometry,
  'POINT Z (10.0 20.0 30.0)',
);

// a point with a measured 2D position (x: 10.0, y: 20.0, m: 40.0)
Point.parse(
  format: WKT.geometry,
  'POINT M (10.0 20.0 40.0)',
);

// a point with a measured 3D position
// (x: 10.0, y: 20.0, z: 30.0, m: 40.0)
Point.parse(
  format: GeoJSON.geometry,
  '{"type": "Point", "coordinates": [10.0, 20.0, 30.0, 40]}',
);
Point.parse(
  format: WKT.geometry,
  'POINT ZM (10.0 20.0 30.0 40.0)',
);

Implementation

factory Point.parse(
  String text, {
  TextReaderFormat<SimpleGeometryContent> format = GeoJSON.geometry,
  CoordRefSys? crs,
  Map<String, dynamic>? options,
}) =>
    GeometryBuilder.parse<Point>(
      text,
      format: format,
      crs: crs,
      options: options,
    );