Name

ST_Multi — Forces a geometry to be MULTI* type. Geometries already Multi, remain unchanged.

Synopsis

geometry ST_Multi(bytea Geometry);

Alias

Multi

Description

Forces a geometry to be MULTI* type. As a result, single classes (Point, LineString, Polygon) are converted into collection classes of geometries (MultiPoint, MultiLineString, Multipolygon). Geometries already Multi or GeometryCollections remain unchanged.

Coordinate Dimensions
2D3DM
Spatial Standards Support
OGC SFS for SQL. 1.1 (1999)OGC SFS for SQL. 1.1.0 (2005)OGC SFS for SQL. 1.2.0 (2006)SQL-MM Part 3
----

Examples

SELECT ST_AsEWKT(ST_Multi(ST_GeomFromEWKT('POINT(0 0 -4)')));
--Result
MULTIPOINT (0 0 -4)

SELECT ST_AsEWKT(ST_Multi(ST_GeomFromEWKT('LINESTRING (0 0 4, 10 10 5, 20 10 6)')));
--Result
MULTILINESTRING ((0 0 4, 10 10 5, 20 10 6))

SELECT ST_AsText(ST_Multi(ST_GeomFromText('POLYGON ((0 0, 0 10, 10 10, 10 0, 0 0),(5 2, 5 5, 0 5, 5 2))')));
--Result
MULTIPOLYGON (((0 0, 0 10, 10 10, 10 0, 0 0), (5 2, 5 5, 0 5, 5 2)))

--Incoming geometry Multi, remains unchanged--
SELECT ST_AsEWKT(ST_Multi(ST_GeomFromEWKT('MULTILINESTRING ((0 0, 10 10, 20 10),(30 30, 40 40, 50 40))')));
--Result
MULTILINESTRING ((0 0, 10 10, 20 10), (30 30, 40 40, 50 40))

Related functions