[postgis-users] Bounding box intersect on multiple spatial tables

Berry R A (AT) RABerry at glam.ac.uk
Tue May 24 04:25:04 PDT 2011


Hi all

I am helping to build a web mapping application using Openlayers, Geoserver and PostGIS. One of the fundamental functions that we need to build into the application is the facility to allow users to define a bounding box on the map to discover all the spatial data available for that area. I'm currently working on the database SQL needed to process such a request. I've written the following query that allows me to retrieve the data within a bounding box for a single polygon layer:

SELECT policeareas.gid, policeareas.name, ST_AsEWKT(policeareas.the_geom) as WKT FROM policeareas, boundingbox WHERE ST_Intersects(boundingbox.the_geom, policeareas.the_geom);

What I don't know how to do is to write a query that retrieves ALL spatial data (point, line and polygon layers/tables) in the database within the specified search area. Also, should I be using Box2d or Box3d to handle my bounding box object?

Any help/pointers appreciated.

Thanks

Rob




Dr Robert Berry
Wales Institute of Social and Economic Research, Data and Methods (WISERD)
Room J308b
GIS Research Centre
Faculty of Advanced Technology
University of Glamorgan
CF371DL

01443 483377
raberry at glam.ac.uk

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20110524/a60e0652/attachment.html>


More information about the postgis-users mailing list