Geographic.build constructor

Geographic.build(
  1. Iterable<num> coords, {
  2. int offset = 0,
  3. Coords? type,
})

Builds a geographic position from coords starting from offset.

Supported coordinate value combinations for coords are: (lon, lat), (lon, lat, elev), (lon, lat, m) or (lon, lat, elev, m)

Use an optional type to explicitely set the coordinate type. If not provided and coords has 3 items, then (lon, lat, elev) coordinates are assumed.

Throws FormatException if coordinates are invalid.

Examples:

// a 2D position (lon: 10.0, lat: 20.0)
Geographic.build([10.0, 20.0]);

// a 3D position (lon: 10.0, lat: 20.0, elev: 30.0)
Geographic.build([10.0, 20.0, 30.0]);

// a measured 2D position (lon: 10.0, lat: 20.0, m: 40.0)
// (need to specify the coordinate type XYM)
Geographic.build([10.0, 20.0, 40.0], type: Coords.xym);

// a measured 3D position (lon: 10.0, lat: 20.0, elev: 30.0, m: 40.0)
Geographic.build([10.0, 20.0, 30.0, 40.0]);

Implementation

factory Geographic.build(
  Iterable<num> coords, {
  int offset = 0,
  Coords? type,
}) =>
    Position.buildPosition(
      coords,
      to: Geographic.create,
      offset: offset,
      type: type,
    );