ST_MPointFromText

更新时间:
复制 MD 格式

Constructs a MultiPoint geometry object from a Well-Known Text (WKT) string and an optional spatial reference identifier (SRID).

Syntax

geometry ST_MPointFromText(text wKT, integer srid);
geometry ST_MPointFromText(text wKT);

Parameters

ParameterTypeDescription
wKTtextA WKT string representing a MultiPoint geometry.
sridintegerThe SRID of the resulting MultiPoint object. Defaults to 0 if not specified.

Usage notes

  • If the WKT string does not represent a MultiPoint geometry, the function returns null.

If the input is guaranteed to represent a MultiPoint object, use ST_GeomFromText instead. It skips the MultiPoint-specific validation check and runs faster.

Examples

Construct a MultiPoint object without an SRID:

SELECT ST_AsText(ST_MPointFromText('MULTIPOINT(1 2,3 4)'));
        st_astext
-------------------------
 MULTIPOINT((1 2),(3 4))
(1 row)