[postgis-users] overlaps with different geometry types

Johannes Bühler johannesbuehler at oderbruecke.de
Fri Nov 26 08:59:43 PST 2004


Hi 
i want to have the same query syntax to make a query on a polgon, line point or geometrycollection column or any other geometry type.

is used the following syntax to query all lines in a box

SELECT AUXDAT.GEWAESSER.GEOM_ID as GEOM_ID, AUXDAT.GEWAESSER.NAME as NAME, AUXDAT.GEWAESSER.GEWAESSER as GEWAESSER FROM AUXDAT.GEWAESSER WHERE ( AUXDAT.GEWAESSER.GEWAESSER&&geometryfromtext('BOX3D(501540.296700 71680.601200, 539906.562400 99260.534400)'::BOX3D,2) and OVERLAPS(AUXDAT.GEWAESSER.GEWAESSER, geometryfromtext('BOX3D(501540.296700 71680.601200, 539906.562400 99260.534400)'::BOX3D,2)) = true)

this is fine but doesent work on a polygon feature. Therefore i have to use the following syntax using the envelope function to create a polygon from the box3d. 

SELECT GEODAT.ADMUNIT2.GEOM_ID as GEOM_ID, GEODAT.ADMUNIT2.NAME as NAME, GEODAT.ADMUNIT2.SELECT_NAME as SELECT_NAME, GEODAT.ADMUNIT2.ADMUNIT2 as ADMUNIT2 FROM GEODAT.ADMUNIT2 WHERE ( GEODAT.ADMUNIT2.ADMUNIT2 && geometryfromtext('BOX3D(8.980000 47.144667, 10.492000 47.808000)'::BOX3D,1) and OVERLAPS(GEODAT.ADMUNIT2.ADMUNIT2, envelope(geometryfromtext('BOX3D(8.98 47.144667, 10.492000 47.808000)'::BOX3D,1))) = true);

But this syntax doesnt work on the line features. Does anyone now a solution how to query different geometry types with the same query syntax?

thanks
Johannes

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20041126/8cdf1e72/attachment.pgp>


More information about the postgis-users mailing list