Extracts geometries from a GeometryCollection into a typed multi geometry.
If the input geometry is a GeometryCollection, the function will return a multi geometry, determined by the type parameter.
if
type= 1, returns a MultiPoint containing all the Points in the collectionif
type= 2, returns a MultiLineString containing all the LineStrings in the collectionif
type= 3, returns a MultiPolygon containing all the Polygons in the collection
If no type parameters is provided, the function will return a multi geometry matching the highest "surface dimension"
of the contained geometries. E.g. if the collection contains only Points, a MultiPoint will be returned. But if the
collection contains both Points and LineStrings, a MultiLineString will be returned. Similarly, if the collection
contains Polygons, a MultiPolygon will be returned. Contained geometries of a lower surface dimension will be ignored.
If the input geometry contains nested GeometryCollections, their geometries will be extracted recursively and included into the final multi geometry as well.
If the input geometry is not a GeometryCollection, the function will return the input geometry as is.