Was this helpful?
GeometryCollection Data Type
Collections can group points, linestrings, and polygons together.
A general GeometryCollection can group different types together, whereas MultiPoint, MultiLinestring, and MultiPolygon are geometry collections that hold features of the same type.
Examples:
Without specifying SRID:
CREATE TABLE mishmash (name VARCHAR(30), path GEOMETRYCOLLECTION);
With specifying SRID:
CREATE TABLE mishmash (name VARCHAR(30), path GEOMETRYCOLLECTION SRID 26911);
Geometry collections can mix singular types:
CREATE TABLE collections (id INTEGER PRIMARY KEY, collection GEOMETRYCOLLECTION);
 
INSERT INTO collections (id, collection) VALUES (1, GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION( POLYGON ((0 0, 10 10, 0 10, 0 0)), POLYGON ((0 0, 10 10, 10 0, 0 0)))'));
 
INSERT INTO collections (id, collection) VALUES (2, GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION( POLYGON ((0 0, 10 10, 0 10, 0 0)), POINT (50 50))'));
Last modified date: 11/28/2023