[postgis-users] FW: Support in ST_ConvexHull syntax

Gery . gamejihou at hotmail.com
Wed Oct 19 11:03:27 PDT 2011


Ok, this command works, it creates the polygon:

mop=# SELECT astext(ST_ConvexHull(ST_Collect(geom))) FROM splitbeam_point ;
                                                                                                                                                                                 
                                                                                                          astext                                                                 
                                                                                                                                                                                 
                                          
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------
 POLYGON((-75.94597458 -15,-75.96461417 -14.9999475,-76.17517096 -14.9280957,-76.37991658 -14.84796663,-77.79001042 -12.93415627,-78.66614083 -11.59082042,-78.85483333 -11.192,-
78.79954917 -11.06366667,-78.79913452 -11.06333333,-78.7638042 -11.0353042,-78.76359208 -11.03516667,-78.76333333 -11.035,-78.68304833 -11.00004833,-78.64921125 -11,-77.69183333
 -11,-77.68228333 -11.00000167,-77.68035 -11.00008706,-77.21898333 -11.66674213,-76.24968122 -13.34319177,-76.19483333 -13.44933333,-75.4739264 -14.99995693,-75.48324551 -14.999
98633,-75.49235204 -15,-75.94597458 -15))
(1 row)

I tried the following to put this result into my new table but doesnt work:

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

Gery





----------------------------------------
> From: gamejihou at hotmail.com
> To: postgis-users at postgis.refractions.net
> Subject: FW: Support in ST_ConvexHull syntax
> Date: Wed, 19 Oct 2011 13:59:06 +0000
>
>
>
> Thanks, I added it but get the following message: new row for relation "unaprueba" violates check constraint "enforce_geotype_geom"
>
> The idea is to create just one polygon based on the points distribution, so I don't need multipolygon, is it right?
>
>
> ----------------------------------------
> > From: gamejihou at hotmail.com
> > To: postgis-users at postgis.refractions.net
> > Subject: Support in ST_ConvexHull syntax
> > Date: Wed, 19 Oct 2011 13:23:28 +0000
> >
> >
> >
> > Hello,
> >
> > After reading a while, I don't get the polygon from my points table (splitbeam_point) I think it is possible through the following script:
> >
> > DROP TABLE testone;
> > CREATE TABLE testone(
> > ID INT
> > );
> > SELECT AddGeometryColumn('public', 'testone', 'geom', 4326, 'POLYGON', 2);
> > CREATE INDEX testone_geom ON testone USING GIST ( geom );
> > INSERT INTO testone SELECT ST_ConvexHull(ST_Collect(geom)) AS testone_geom FROM splitbeam_point GROUP BY ID;
> >
> > I get this error message: column "id" is of type integer but expression is of type geometry
> >
> > and after I insert ::numeric,4 in the ST_ConvexHull statement, I get: ERROR: cannot cast type geometry to numeric
> >
> > How can I circumvent this error?
> >
> > Any support is very welcome, thanks,
> >
> > Gery
> >
>
 		 	   		  


More information about the postgis-users mailing list