[postgis-users] create multipolygon

Maxime van Noppen maxime at altribe.org
Thu Sep 24 03:18:18 PDT 2009


eehab hamzeh wrote:
> SELECT asEwkt(ST_Multi(ST_Union(ARRAY(SELECT the_geom FROM faces_obj))));

Hi,

Did you try to simply do :

SELECT ST_Multi(ST_Union(the_geom)) FROM faces_obj;

The ST_Union function will merge polygons if it is possible.

BTW, some of you polygons are invalid (check them with ST_IsValid). For 
example the first one :

> # SELECT ST_IsValid('POLYGON((-14161.75 2241.76 2600,-14161.75 2241.76 2900,-14161.75 1941.76 2900,-14161.75 1941.76 2600,-14161.75 2241.76 2600))');
> NOTICE:  Too few points in geometry component at or near point -14161.8 2241.76 2600
>  st_isvalid 
> ------------
>  f

-- 
Maxime



More information about the postgis-users mailing list