[postgis-users] geoms_overlapping_box3d

strk strk at freek.keybit.net
Mon Dec 2 08:13:20 PST 2002


Hello,
This will be a litte long...

I need to get all geometry objects overlapping
a bounding box.

Now, for multigeometries I'd like to have only
the subset of object overlapping the bounding box,

The overlap operators will not do this for me because
it will check the overall bounding volume for all
objects in geometry.

The solution could be a function like
geoms_overlapping_box3d(geometry, box3d)

I think this will be usefull also for the mapserver
connector, so that a smaller dataset is transferred ...

Right now I'm doing this by hand using postgis function
bbox_of_point, bbox_of_polygon and friends, but since
I also want to know the extent of the recordset returned
I'm having an erroneus information (I'm getting the extent
BEFORE the objects reduction).

Best would be:
        SELECT extent(geoms_overlapping_box3d(the_geom, <bbox>))
        WHERE the_geom && <bbox>;

The overlapping check in the WHERE clause could be instead expressed as:
        SELECT extent(geoms_overlapping_box3d(the_geom, <bbox>)) as the_geom
        WHERE geoms_overlapping_box3d(the_geom, <bbox>) IS NOT NULL;

But the first form is faster, isn't it ?

--strk;



More information about the postgis-users mailing list