ST_MultiPoint

The ST_MultiPoint function has two variations.

In the first variation, ST_MultiPoint constructs a multipoint from a well-known text representation, a well-known binary representation, or an ESRI shape representation. An optional spatial reference system identifier can be specified to indicate the spatial reference system the resulting multipoint is in.

In the second variation, ST_MultiPoint takes ST_Geometry as an input parameter and casts the output type to ST_MultiPoint. If the given geometry is null, then null is returned.

Syntax for variation 1

Variation 1

Read syntax diagramSkip visual syntax diagramdb2gse.ST_MultiPoint(wktwkbshapegml,srs_id)

Parameters for variation 1

wkt
A value of type CLOB(8M) that contains the well-known text representation of the resulting multipoint. If the well-known text representation is null, then null is returned.
wkb
A value of type BLOB(4M) that contains the well-known binary representation of the resulting multipoint. If the well-known binary representation is null, then null is returned.
shape
A value of type BLOB(4M) that contains the shape representation of the resulting multipoint. If the shape representation is null, then null is returned.
gml
A value of type CLOB(8M) that contains the GML representation of the geometry. If the GML representation is null, then null is returned.
srs_id
A value of type INTEGER that identifies the spatial reference system for the resulting multipoint.

If srs_id does not identify a spatial reference system listed in the catalog view DB2GSE.ST_SPATIAL_REFERENCE_SYSTEMS, an error is returned (SQLSTATE 38SU1).

Return type for variation 1

db2gse.ST_MultiPoint

Syntax for variation 2

Variation 2

Read syntax diagramSkip visual syntax diagramdb2gse.ST_MultiPoint(geometry)

Parameter for variation 2

geometry
A value of type ST_Geometry.

Return type for variation 2

ST_MultiPoint

Examples

In the following example, the lines of results have been reformatted for readability.

This example illustrates how ST_MultiPoint can be used to create and insert a multipoint from its well-known text representation. The record that is inserted has ID = 1110, and the geometry is a multipoint in spatial reference system 1. The multipoint is in the well-known text representation of a multipoint. The X and Y coordinates for this geometry are: (1, 2) (4, 3) (5, 6).

SET CURRENT PATH = CURRENT PATH, db2gse;
CREATE TABLE sample_mpoints (id INTEGER, geometry ST_MultiPoint);

INSERT INTO sample_mpoints
  VALUES (1110, ST_MultiPoint ('multipoint (1 2, 4 3, 5 6)', 1));
The following SELECT statement returns the multipoint that was recorded in the table:

SELECT id, CAST( ST_AsText(geometry) AS VARCHAR(90)) MULTIPOINT
  FROM sample_mpoints
  WHERE id = 1110;
Results:

ID         MULTIPOINT
---------- -----------------------------------------------------
      1110 MULTIPOINT (1.000000 2.000000, 4.000000 
           3.000000, 5.000000 6.000000)