Multi-geometry types and operations. All constructors take ownership of input geometry handles. See also: docs/geometries/multi.md.String representation — "MultiPoint(N points)" where N is the point count. Raises NilAccessDefect if the MultiPoint is nil.String representation — "MultiLineString(N linestrings)" where N is the line count. Raises NilAccessDefect if the MultiLineString is nil.String representation — "MultiPolygon(N polygons)" where N is the polygon count. Raises NilAccessDefect if the MultiPolygon is nil.String representation — "GeometryCollection(N geometries)" where N is the component count. Raises NilAccessDefect if the GeometryCollection is nil.
Types
GeometryCollection = ref GeometryCollectionObj
- Reference type for a GeometryCollection.
GeometryCollectionObj = object of GeometryObj
- A mixed collection of any geometry types.
MultiLineString = ref MultiLineStringObj
- Reference type for a MultiLineString collection.
MultiLineStringObj = object of GeometryObj
- A collection of LineString geometries.
MultiPoint = ref MultiPointObj
- Reference type for a MultiPoint collection.
MultiPointObj = object of GeometryObj
- A collection of Point geometries.
MultiPolygon = ref MultiPolygonObj
- Reference type for a MultiPolygon collection.
MultiPolygonObj = object of GeometryObj
- A collection of Polygon geometries.
Procs
proc createMultiGeometry(ctx: var GeosContext; geoms: var seq[Geometry]): Geometry {. ...raises: [GeosInitError, GeosGeomError], tags: [], forbids: [].}
-
Unified multi-geometry constructor. Infers the collection type from the input geometries: all Point → MultiPoint all LineString → MultiLineString all Polygon → MultiPolygon mixed → GeometryCollection Takes ownership of all geometry handles. Do NOT use geoms after this call.
var ctx = initGeosContext() var geoms: seq[Geometry] geoms.add(ctx.createPoint(0.0, 0.0)) geoms.add(ctx.createPoint(1.0, 1.0)) let mp = ctx.createMultiGeometry(geoms) # → MultiPoint echo mp # MultiPoint(2 points)
Raises GeosInitError if ctx is destroyed; GeosGeomError if geoms is empty, contains a nil geometry, or GEOS fails.
Methods
method `$`(g: GeometryCollection): string {....raises: [GeosGeomError], tags: [], forbids: [].}
method `$`(g: MultiLineString): string {....raises: [GeosGeomError], tags: [], forbids: [].}
method `$`(g: MultiPoint): string {....raises: [GeosGeomError], tags: [], forbids: [].}
method `$`(g: MultiPolygon): string {....raises: [GeosGeomError], tags: [], forbids: [].}