[postgis-users] ERROR: new row for relation "x"violates checkconstraint "enforce_geotype_the_geom"
Obe, Regina
robe.dnd at cityofboston.gov
Thu Aug 9 10:59:59 PDT 2007
What does
select distinct(geometrytype(multi(geomunion(t1.the_geom, t2.the_geom))))
from gf_veg1 t1, gf_veg2 t2
return you. Are you sure both your fields are POLYGONS or MULTIPOLYGONS?
________________________________
From: postgis-users-bounces at postgis.refractions.net on behalf of Andreas Laggner
Sent: Thu 8/9/2007 9:42 AM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] ERROR: new row for relation "x"violates checkconstraint "enforce_geotype_the_geom"
Hi Regina,
if i integrate your statement like this:
drop table intersect_gf3;
create table intersect_gf3(gid integer) with oids;
select
addgeometrycolumn('','intersect_gf3','the_geom','31467','MULTIPOLYGON',2);
insert into intersect_gf3
select t1.gid,multi(intersection(t1.the_geom, t2.the_geom))
from gf_clc t1, gf_veg1 t2
where t1.the_geom && t2.the_geom;
i although get the error:
ERROR: new row for relation "intersect_gf3" violates check constraint
"enforce_geotype_the_geom"
SQL Status:23514
hasta luego Andreas
Obe, Regina schrieb:
> In addition to what Frank mentioned. Often times Geomunion applied to polygons or multipolygons may return a Polygon rather than a MultiPolygon.
>
> To force it into a multipolygon type, wrap a multi call around it. Something like
>
> select t1.gid,multi(geomunion(t1.the_geom, t2.the_geom))
> from gf_veg1 t1, gf_veg2 t2;
>
> -----------------------------------
> Also why are you doing a cartesian join?
>
> Hope that helps,
> Regina
>
> -----Original Message-----
> From: postgis-users-bounces at postgis.refractions.net [mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Frank Koormann
> Sent: Thursday, August 09, 2007 6:04 AM
> To: PostGIS Users Discussion
> Subject: Re: [postgis-users] ERROR: new row for relation "x" violates checkconstraint "enforce_geotype_the_geom"
>
> Hi again,
>
> * Andreas Laggner <bloediandi at web.de> [070809 11:21]:
>
>> i have to delete this constraint in EVERY table i want to write to! I
>> think that is not normal?!
>>
>
> Partly - yes:
>
> - AddGeometryColumn creates a contraint according to the geometry type
> specified to be compliant with OGC.
> - As a consequence you should first check the potential outcome of your
> geomunion operation before creating the geomcolumn, you might run
> something like:
>
> select distinct(geometrytype(geomunion(t1.the_geom, t2.the_geom)))
> from gf_veg1 t1, gf_veg2 t2
> where t1.the_geom && t2.the_geom;
>
> Regards,
>
> Frank
>
>
_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
-----------------------------------------
The substance of this message, including any attachments, may be
confidential, legally privileged and/or exempt from disclosure
pursuant to Massachusetts law. It is intended
solely for the addressee. If you received this in error, please
contact the sender and delete the material from any computer.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20070809/a41e471c/attachment.html>
More information about the postgis-users
mailing list