[postgis-users] Computing the overal bounding box

Chris Hodgson chodgson at refractions.net
Tue Jun 11 13:40:39 PDT 2002


Something like:

SELECT min( xmin( box3d( the_geom ) ) ), min( ymin( box3d( the_geom ) ) ), max(
xmax( (box3d( the_geom ) ) ), max( ymax( box3d( the_geom ) ) ) FROM table

should do it relatively efficietly, I think. The following:

SELECT box3d( collect( the_geom ) ) FROM table

would work, but I wouldn't recommend it for large tables (or at all, really) -
the entire table will be put into one geometry, by adding one row at a time...
that will suck up a lot of memory!

Chris Hodgson

David Garnier wrote:

> Hello,
> I have a large amount of data loaded in my PostGis DB, and I'd like to
> compute the overall bounding box enclosing every feature using a SQL query..
> Speed isn't a real concern.
>
> Best regards,
> David Garnier
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users





More information about the postgis-users mailing list