A `MULTIPOINT` is a collection of Points. MultiPoints are useful for gathering a group of Points into one geometry. For example, you may want to gather the points denoting all of the State Capitols in the U.S. into a single geometry.

You can also store a `MULTIPOINT` with the following additional dimensions:

• A third dimension coordinate `Z` (`MULTIPOINTZ`).
• A measure coordinate `M` (`MULTIPOINTM`).
• Both a third dimension and a measure coordinate (`MULTIPOINTZM`).

The `Z` and `M` dimensions can be accessed or modified using a number of built-in functions, including:

• `ST_Z`
• `ST_M`
• `ST_Affine`
• `ST_Zmflag`
• `ST_MakePoint`
• `ST_MakePointM`
• `ST_Force3D`
• `ST_Force3DZ`
• `ST_Force3DM`
• `ST_Force4D`
• `ST_Snap`
• `ST_SnapToGrid`
• `ST_RotateZ`
• `ST_AddMeasure`

Note that CockroachDB's spatial indexing is still based on the 2D coordinate system. This means that:

• The Z/M dimension is not index accelerated when using spatial predicates.
• Some spatial functions ignore the Z/M dimension, with transformations discarding the Z/M value.

## Examples

### SQL

A MultiPoint can be created from SQL by calling an aggregate function such as `ST_Collect` or `ST_Union` on a column that contains Point geometries. In the example below, we will build a MultiPoint from several Points.

1. Insert the Points:

``````CREATE TABLE tmp_points (id INT8 default unique_rowid(), geom GEOMETRY);

INSERT INTO tmp_points (geom)
VALUES
(st_geomfromtext('POINT (-88.243357000000003 40.117404000000001)')),
(st_geomfromtext('POINT (-94.598371 39.050068000000003)')),
(st_geomfromtext('POINT (-73.962090000000003 40.609226)'));
``````
2. Build a MultiPoint from the individual Points using `ST_Collect`, and check the output with `ST_GeometryType` to verify that it is indeed a MultiPoint:

``````SELECT ST_GeometryType(st_collect(geom)) AS output FROM tmp_points;
``````
``````    output
-----------------
ST_MultiPoint
(1 row)
``````
3. Drop the temporary table:

``````DROP TABLE tmp_points;
``````

### Well known text

A MultiPoint can be created from SQL by calling the `st_geomfromtext` function on a MultiPoint definition expressed in the Well Known Text (WKT) format.

For example, the MultiPoint in the example below includes the locations of independent bookstores in Chicago, Illinois USA:

``````SELECT ST_GeomFromText('MULTIPOINT (-87.738258999999999 42.010930999999999, -87.716257999999996 41.981231000000001, -87.708889999999997 41.975000000000001, -87.707705000000004 41.929195999999997, -87.707192000000006 41.926580000000001, -87.704300000000003 41.928013999999997, -87.698012000000006 41.939076, -87.682384999999996 41.943232000000002, -87.681599000000006 41.705936999999999, -87.677763999999996 41.916998, -87.674808999999996 41.9086, -87.668653000000006 41.977356999999998, -87.668611999999996 41.904580000000003, -87.664944000000006 41.921931999999998, -87.655131999999995 41.881686000000002, -87.654752999999999 41.881632000000003, -87.654584 41.944774000000002, -87.653409999999994 41.857928000000001, -87.650779999999997 41.926853000000001, -87.644745999999998 41.941915999999999, -87.644356999999999 41.899109000000003, -87.634562000000003 41.897446000000002, -87.630498000000003 41.899751000000002, -87.629164000000003 41.873215999999999, -87.627983999999998 41.883583999999999, -87.627189999999999 41.890832000000003, -87.624488999999997 41.885147000000003, -87.624283000000005 41.876899000000002, -87.624251999999998 41.874115000000003, -87.622851999999995 41.894931999999997, -87.619151000000002 41.864832999999997, -87.597796000000002 41.789636000000002, -87.596547999999999 41.790515999999997, -87.594948000000002 41.791434000000002, -87.591048999999998 41.808132999999998, -87.590436999999994 41.783611000000001, -87.590277 41.800938000000002)');
``````
``````                                                                               st_geomfromtext
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------