fromWkbId static method

Coords fromWkbId(
  1. int id
)

Selects a Coords enum based on the WKB type id.

Expected values are:

  • 0 for 2D coordinates: (x,y) or (lon,lat)
  • 1000 for 3D coordinates: (x,y,z) or (lon,lat,elev)
  • 2000 for measured coordinates: (x,y,m) or (lon,lat,m)
  • 3000 for 3D / measured coordinates: (x,y,z,m) or (lon,lat,elev,m)

References:

Implementation

static Coords fromWkbId(int id) {
  switch ((id ~/ 1000) * 1000) {
    case 0:
      return Coords.xy;
    case 1000:
      return Coords.xyz;
    case 2000:
      return Coords.xym;
    case 3000:
      return Coords.xyzm;
    default:
      throw const FormatException('Invalid WKB id');
  }
}