ST_ToMultiPoint function

The ST_ToMultiPoint function takes a geometry as an input parameter and converts it to a multipoint. The resulting multipoint is represented in the spatial reference system of the given geometry.

The given geometry must be empty, a point, or a multipoint. If the given geometry is null, then null is returned.

This function can also be called as a method.

Syntax

Read syntax diagramSkip visual syntax diagramdb2gse.ST_ToMultiPoint(geometry)

Parameter

geometry
A value of type ST_Geometry or one of its subtypes that represents the geometry that is converted to a multipoint.

A geometry can be converted to a multipoint if it is empty, a point, or a multipoint. If the conversion cannot be performed, then an exception condition is raised (SQLSTATE 38SUD).

Return type

db2gse.ST_MultiPoint

Example

In the following example, the lines of results have been reformatted for readability. The spacing in your results will vary according to your online display

This example illustrates the use of the ST_ToMultiPoint function.

SET CURRENT FUNCTION PATH = CURRENT FUNCTION PATH, db2gse
CREATE TABLE sample_geometries (id INTEGER, geometry ST_Geometry)

INSERT INTO sample_geometries
  VALUES (1, ST_Geometry ('multipoint (0 0, 0 4)', 1) ),
         (2, ST_Geometry ('point (30 40)', 1) ),
         (3, ST_Geometry ('multipolygon empty', 1) )
In the following SELECT statement, the ST_ToMultiPoint function is used to return multipoints converted to ST_MultiPoint from the static type of ST_Geometry.

SELECT CAST( ST_AsText( ST_ToMultiPoint(geometry)) 
  AS VARCHAR(62) ) MULTIPOINTS
FROM sample_geometries
Results:

MULTIPOINTS
--------------------------------------------------------------
MULTIPOINT ( 0.00000000 0.00000000, 0.00000000 4.00000000)
MULTIPOINT ( 30.00000000 40.00000000)
MULTIPOINT EMPTY