dimension property

  1. @override
int dimension
override

The topological dimension of this geometry.

For example returns 0 for point geometries, 1 for linear geometries (like linestring or linear ring) and 2 for polygons or surfaces. For geometry collections this returns the largest dimension of geometries contained in a collection.

Please note that this is different from spatial and coordinate dimensions that are available on Point geometries.

Implementation

@override
int get dimension {
  // A base implementation for calculating a maximum dimension for a series by
  // looping through all items. Should be overridden to provide more efficient
  // implementation as needed.
  var dim = 0;
  for (final element in geometries) {
    dim = math.max(dim, element.dimension);
  }
  return dim;
}