fromWkbId static method

Geom fromWkbId(
  1. int id
)

Selects a Geom enum based on the WKB type id.

Expected values (for the 2-dimensional geometry) are:

  • 1 for the point type
  • 2 for the lineString type
  • 3 for the polygon type
  • 4 for the multiPoint type
  • 5 for the multiLineString type
  • 6 for the multiPolygon type
  • 7 for the geometryCollection type

References:

Implementation

static Geom fromWkbId(int id) {
  switch (id % 1000) {
    case 1:
      return Geom.point;
    case 2:
      return Geom.lineString;
    case 3:
      return Geom.polygon;
    case 4:
      return Geom.multiPoint;
    case 5:
      return Geom.multiLineString;
    case 6:
      return Geom.multiPolygon;
    case 7:
      return Geom.geometryCollection;
    default:
      throw FormatException('Invalid WKB id $id');
  }
}