ST_MultiPoint function

The ST_MultiPoint function constructs a multipoint from a specified input.

The input can be specified in one of the following formats:
  • Well-known text (WKT) format
  • Well-known binary (WKB) format
  • ESRI shape format
  • GeoJSON format
  • Geography Markup Language (GML) format

An optional spatial reference system identifier can be specified to indicate the spatial reference system the resulting multipoint is in.

If the specified format is null, then null is returned.

For details about the supported formats, see Supported data formats.

Syntax

Read syntax diagramSkip visual syntax diagramST_MultiPoint(wktwkbshapegeojsongml,srs_id)

Parameters

wkt
A value of type VARCHAR or CLOB(2G) that contains the WKT format of the resulting multipoint.
wkb
A value of type VARBINARY or BLOB(2G) that contains the well-known binary format of the resulting multipoint.
shape
A value of type VARBINARY or BLOB(2G) that represents the ESRI shape format of the resulting multipoint.
geojson
A value of type VARCHAR or CLOB(2G) that represents the resulting multipoint using GeoJSON.
gml
A value of type VARCHAR or CLOB(2G) that represents the resulting multipoint using the Geography Markup Language.
srs_id
A value of type INTEGER that identifies the spatial reference system for the resulting multipoint.

If the srs_id parameter is omitted, the spatial reference system with the numeric identifier 4326 is used.

If srs_id does not identify a spatial reference system listed in the catalog view SYSGEO.ST_SPATIAL_REFERENCE_SYSTEMS, then an exception condition is raised (SQLSTATE 38SU1).

Return type

ST_Point

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 how ST_MultiPoint can be used to create and insert a multipoint from its WKT format. The record that is inserted has ID = 1110, and the geometry is a multipoint in spatial reference system 1. The multipoint is in the WKT format of a multipoint. The X and Y coordinates for this geometry are: (1, 2) (4, 3) (5, 6).

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)  


Examples

Example 1:

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 how ST_MultiPoint can be used to create and insert a multipoint from its WKT format. The record that is inserted has ID = 1110, and the geometry is a multipoint in spatial reference system 1. The multipoint is in the WKT format of a multipoint. The X and Y coordinates for this geometry are: (1, 2) (4, 3) (5, 6).

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)  


Example 2:
This example illustrates how ST_MultiPoint can be used to create and insert a multipoint from its GeoJSON format. The record that is inserted has ID = 1111, and the geometry is a multipoint in spatial reference system 4326, which is selected by default.

CREATE TABLE sample_mpoints (id INTEGER, geometry ST_MultiPoint)

INSERT INTO sample_mpoints
  VALUES (1111, ST_MultiPoint ('{ "type": "multipoint", "coordinates": [[1, 2], [4, 3], [5, 6]] }'))
The following SELECT statement returns the multipoint that was recorded in the table:

SELECT id, CAST( ST_AsText(geometry) AS VARCHAR(200)) MULTIPOINT
  FROM sample_mpoints
  WHERE id = 1111
Results:

ID          MULTIPOINT
----------- --------------------------------------------------------------------------------------
       1111 MULTIPOINT (1.000000000 2.000000000, 4.000000000 3.000000000, 5.000000000 6.000000000)