12

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?

16

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"
| improve this answer | |
9

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.

| improve this answer | |

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.