[postgis-devel] Adding intersects support for GeometryCollection/Box

Markus Schneider schneider at lat-lon.de
Wed Jun 4 09:00:21 PDT 2008


Hello,

I am wondering about the things that need to be done to get the intersects
predicate for geometries of type GeometryCollection working.

Our WMS implementation (http://www.deegree.org) uses statements of the following
form to retrieve geometries inside the view window:

SELECT X1.GEOM,X1.NAME,X1.ID FROM MULTITEST X1
WHERE X1.GEOM && SetSRID('BOX3D(...)'::box3d,...)
AND intersects (X1.GEOM, SetSRID('BOX3D(...)'::box3d,...))

As already discussed on postgis-users (thanks, Martin!), this statement
currently leads to an error message if any geometries of type GeometryCollection
are involved in the intersects-test:

ERROR: Relate Operation called with a LWGEOMCOLLECTION type.  This is unsupported
SQL Status:XX000

For our special use case, we would only need
intersects(GeometryCollection,Box3D). As I see it, the relevant function is in
lwgeom/lwgeom_geos_c.c, line 2016 (SVN-version):

Datum intersects(PG_FUNCTION_ARGS)
{
...
}

Is this correct? And do you think that it is feasible to evaluate the intersects
predicate between a Box3D and GeometryCollection by checking if any geometry
contained in the GeometryCollection intersects the Box3D?

As GeometryCollections can be nested (and may contain GeometryCollections as
members), one would have to perform a recursion in the GeometryCollection to
find all (non-GeometryCollection) geometries to be tested, right?

Do you think that this is a good approach? And is there a chance to get this
into the PostGIS code base? As I am new to PostGIS development, I am not sure if
I can implement this, but the problem itself does not look too complicated...


Best regards,

-- 
Markus Schneider

l a t / l o n  GmbH
Aennchenstrasse 19               53177 Bonn, Germany
phone ++49 +228 18496-0          fax ++49 +228 18496-29
http://www.lat-lon.de            http://www.deegree.org

-------------------------------------------------------
On June 17 is deegree day - Am 17. Juni ist deegree day
              http://deegree.org/deegreeday




More information about the postgis-devel mailing list