Multipoint vs point PostGIS
To convert "Multipoint" to "Point", you have to use ST_Dump, for example:
SELECT (ST_Dump(the_geom)).geom AS the_POINT_geom
FROM MULTIPOINT_table;
On the question of using "Multi" or single geometries, I use this logic:
- if every geometry has different attributes -> Single
- if a group of geometries have same attributes -> "Multi"
The easiest way to extract a point from a single-point MULTIPOINT
is ST_GeometryN
:
SELECT ST_AsText(ST_GeometryN('MULTIPOINT ((1 1))', 1));
--POINT(1 1)
This avoids potential problems in situations where a set-returning function cannot be used.
There are some important optimizations that are available only to POINT
type geometries (especially in earlier versions of PostGIS), so storing single points as POINT
is good practice. A POINT
also uses about 25% less space than a MULTIPOINT
.