[postgis-users] ST_Intersects and NOT ST_Disjoint aren't equal?

Martin Davis mbdavis at refractions.net
Thu Mar 26 08:58:09 PDT 2009


Can you find a single geometry where NOT ST_Disjoint and ST_Intersects 
are different?  That will help in debugging this behaviour.

Gerrit Hoven wrote:
> Hello Postgis Users
>
> I was wondering about the behavior of ST_Disjoint and ST_Intersects.
>
> My data is a 3D citymodel which is stored in "tbl_surface". There is 
> the geometry column "geom".
> Normally I expect the same behavior of "WHERE ST_Intersects(...)" and 
> "WHERE NOT ST_Disjoint(...)"
>
> But look what happens if I try to get everything inside a huge 
> boundingbox:
>
> Query A:
> select geom from tbl_surface where 
> ST_Intersects(ST_GeomFromText('Polygon((0 0, 9999999 0, 9999999 
> 9999999, 0 9999999, 0 0))'), geom)
>
> returns 98524 rows, which I expect because this is all my data and the 
> boundingbox covers them all
>
>
> Query B:
> select geom from tbl_surface where not 
> ST_Disjoint(ST_GeomFromText('Polygon((0 0, 9999999 0, 9999999 9999999, 
> 0 9999999, 0 0))'), geom)
>
> returns: 61895 rows (should be 98524 ???)
>
>
> Query C:
> select geom from tbl_surface where 
> ST_Disjoint(ST_GeomFromText('Polygon((0 0, 9999999 0, 9999999 9999999, 
> 0 9999999, 0 0))'), geom)
>
> returns: 36629 rows (should be 0 ???)
>
>
> All my geometries are polygons which have z-coordinates.
> There exist polygons (like walls), which when projecting them to the 
> x-y plane, are only lines. I think this is a hint for the strange 
> behavior of ST_Disjoint. Just look what the query results look like:
>
> This is all my data:
> http://81.89.98.151/Picture/queryA.png
>
> This is everything inside the big box, using NOT ST_Disjoint. All the 
> polygons that are not a line in 2D
> http://81.89.98.151/Picture/queryB.png
>
> This is everything "outside" the big box, using ST_Disjoint. All the 
> polygons that are lines in 2D
> http://81.89.98.151/Picture/queryC.png
>
>
> Can anybody explain this to me? Or is it a bug.
>
>
> Regards,
> Gerrit
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>

-- 
Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022




More information about the postgis-users mailing list