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

Martin Davis mbdavis at refractions.net
Wed Jun 4 10:36:59 PDT 2008


I'm pretty sure that the new PreparedGeometry capability in GEOS 
supports GeometryCollections as input (at least for the second, 
non-prepared arg).   The level of support varies by predicate and target 
geometry type:

- for intersects, GCs are supported for all targets
- for contains, GCs are supported for polygons-with-no-hole targets
- for covers, GCs are supported for polygons-with-no-hole targets

(Not all constraints listed here - as you can see, this gets pretty complex)

Can someone try this and confirm?  Perhaps there should be some test 
cases which show the various combinations allowed.

Markus Schneider wrote:
> 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,
>
>   

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




More information about the postgis-devel mailing list