ST_Multi

更新时间:
复制 MD 格式

Returns the geometry as a MULTI geometry object. If the input is already a MULTI geometry object, the function returns it unchanged.

Syntax

geometry ST_Multi(geometry g1);

Parameters

ParameterDescription
g1The geometry object that you want to specify.

Usage notes

If the input is already a MULTI type (such as MULTILINESTRING), the function returns the original object without modification.

Example

Convert a LINESTRING to a MULTILINESTRING:

SELECT ST_AsText(ST_Multi(ST_GeomFromText('LINESTRING(1 1,2 1)')));

Output:

         st_astext
----------------------------
 MULTILINESTRING((1 1,2 1))
(1 row)