[postgis-users] FW: Support in ST_ConvexHull syntax

Gery . gamejihou at hotmail.com
Thu Oct 20 02:26:48 PDT 2011



Hello Sandro,

Thanks and yes my mistake, I have 2 tables by mistake, ie., 'unaprueba' and 'testone', the first one is the right one, this is what I get after your suggestion:

mop=# \d unaprueba
   Table "public.unaprueba"
 Column |   Type   | Modifiers 
--------+----------+-----------
 id     | smallint | 
 geom   | geometry | 
Indexes:
    "unaprueba_geom" gist (geom)
Check constraints:
    "enforce_dims_geom" CHECK (st_ndims(geom) = 2)
    "enforce_geotype_geom" CHECK (geometrytype(geom) = 'POLYGON'::text OR geom IS NULL)
    "enforce_srid_geom" CHECK (st_srid(geom) = 4326)


mop=# SELECT st_geometrytype(st_convexhull(st_collect(geom))) from splitbeam_point ;
 st_geometrytype 
-----------------
 ST_Polygon
(1 row)

So, I think everything should be right, I dont know why this commad doesnt work:

mop=# insert into unaprueba (geom) SELECT st_convexhull(st_collect(geom)) as geom FROM splitbeam_point ;
ERROR:  new row for relation "unaprueba" violates check constraint "enforce_dims_geom"

where could be the problem?

Gery

----------------------------------------
> Date: Thu, 20 Oct 2011 10:15:41 +0200
> From: strk at keybit.net
> To: postgis-users at postgis.refractions.net
> CC: gamejihou at hotmail.com
> Subject: Re: [postgis-users] FW: Support in ST_ConvexHull syntax
>
> On Wed, Oct 19, 2011 at 06:03:27PM +0000, Gery . wrote:
>
> > mop=# insert into testone (geom) SELECT ST_ConvexHull(ST_Collect(geom)) as geom FROM splitbeam_point ;
> > ERROR:  new row for relation "unaprueba" violates check constraint "enforce_geotype_geom"
> >
> > where could be the error? any hint is very grateful, thanks in advance
>
> The error says that the "geom" field of "unaprueba" table is required
> to be a geometry of a given type and you're trying to insert one of
> a different type instead.
>
> -- shows what type is expected by the table:
> \d unaprueba
>
> -- shows what you're trying to insert:
> SELECT ST_GeometryType(
> ST_ConvexHull(ST_Collect(geom)) FROM splitbeam_point ;
> );
>
> --strk;
>
> () Free GIS & Flash consultant/developer
> /\ http://strk.keybit.net/services.html
 		 	   		  


More information about the postgis-users mailing list