[postgis-users] Error: new row for relation "x" violates checkconstraint "enforce_geotype_the_geom"

Obe, Regina robe.dnd at cityofboston.gov
Tue Jan 8 06:30:06 PST 2008


Andreas,

Intersection doesn't guarantee you get the same geometry type.  It only guarantees that the geometry type returned is of less or equivalent dimensional complexity of the least dimensional complex geometry.  If you think about it - it makes perfect sense. 

For example - if you intersect a line with another line, you either get a line, a point, or the empty set.  If you intersect a polygon with a line - you would get a line, multipoints, a point or empty set.

If you cross two polygons and they only share an edge, you get a line.

One way to get around this issue is to just discard all of these intersection fragments.

e.g

SELECt st_intersection(a.the_geom, b.the_goem)
FROM a INNER JOIN b where st_intersects(a.the_geom, b.the_geom)
WHERE st_geometrytype(st_intersection(a.the_geom,b.the_geom)) = st_geometrytype(a.the_geom)

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 Andreas Laggner
Sent: Tuesday, January 08, 2008 6:57 AM
To: PostGis_Mailinglist
Subject: [postgis-users] Error: new row for relation "x" violates checkconstraint "enforce_geotype_the_geom"

Hi users,

i am intersecting two multipolygons and the result is not a 
mulitpolygon, how can this happen and how can i eliminate this Error?? 
What i often did is to delete the constraint, but this seems to lead to 
other problems.....

ERROR:  new row for relation "atkis2000_f" violates check constraint 
"enforce_geotype_the_geom"

cheers      Andreas

-- 
Dipl. Geoökologe Andreas Laggner
Institut für Ländliche Räume (LR)
Bundesforschungsanstalt für Landwirtschaft (FAL)

Institute of Rural Studies
Federal Agricultural Research Centre (FAL)

Bundesallee 50
D-38116 Braunschweig

Tel.: (+49) (0)531 596 5515
Fax: (+49) (0)531 596 5599
E-mail: andreas.laggner at vti.bund.de
Homepage: http://www.lr.fal.de/ 

_______________________________________________
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.




More information about the postgis-users mailing list