[postgis-users] Documentation on GIS specific SQL

David Blasby dblasby at refractions.net
Thu Feb 20 09:54:46 PST 2003


The reason you're having problems is because extent() is an aggregate
function - like min() or max().

To convert a geometry to a bounding box:

SELECT geom::box3d FROM <Table>
SELECT BOX3D(geom) FROM <table>

Use extent() when you want to find the COMBINED bounding box of several

SELECT extent(property_polygon) FROM property WHERE owner = 'dblasby';
SELECT owner, extent(property_polygon)  FROM property GROUP BY owner;

This of this like the min() and max() functions:

SELECT max(salary) FROM employees WHERE title = 'analyst';
SELECT title,max(salary) FROM employees GROUP BY title;

More information about the postgis-users mailing list