Is it normal to use the geometry type 'multipoint' instead of 'point' knowing that I use it to store only one point?

How can I convert from multipoint to point?


To convert "Multipoint" to "Point", you have to use ST_Dump, for example:

SELECT (ST_Dump(the_geom)).geom AS the_POINT_geom

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.