A GeometryCollection is a heterogenerous collection of other Geometries.
You can create a GeometryCollection by passing in a variable number of Geometries:
def gc = new GeometryCollection(new Point(1,2),new Point(3,4))
Or you can pass in a List of Geometries:
def pts = [new Point(1,2),new Point(3,4)] def gc2 = new GeometryCollection(pts)
| Constructor and description | 
|---|
| GeometryCollection
                                (org.locationtech.jts.geom.GeometryCollection geomCollection)Create a GeometryCollection that wraps a JTS GeometryCollection | 
| GeometryCollection
                                (Geometry... geometries)Create a GeometryCollection from a List of Geometries. | 
| GeometryCollection
                                (java.util.List<Geometry> geometries)Create a GeometryCollection from a List of Geometries. | 
| Type Params | Return Type | Name and description | 
|---|---|---|
|  | Geometry | narrow()Get a Geometry from this GeometryCollection that is the most type specific as possible. | 
|  | GeometryCollection | plus(Geometry geometry)Add a Geometry to this GeometryCollection to create another GeometryCollection. | 
|  | Geometry | slice(java.lang.Integer start = 0, java.lang.Integer end = null)Get a subset of Geometries in the GeometryCollection. | 
Create a GeometryCollection that wraps a JTS GeometryCollection
geomCollection -  The JTS GeometryCollectionCreate a GeometryCollection from a List of Geometries.
def gc = new GeometryCollection(new Point(1,2),new Point(3,4))
points -  A variable List of PointsCreate a GeometryCollection from a List of Geometries.
def pts = [new Point(1,2),new Point(3,4)] def gc2 = new GeometryCollection(pts)
geometries -  A List of GeometriesGet a Geometry from this GeometryCollection that is the most type specific as possible. If all of the Geometries are Points, a MultiPoint is returned.
Add a Geometry to this GeometryCollection to create another GeometryCollection.
geometry -  The GeometryGet a subset of Geometries in the GeometryCollection.
start -  The start index (can be positive or negative)end -  The end index (can be positive or negative)