[postgis-users] Computing the overal bounding box

David Garnier david.garnier at etudier-online.com
Tue Jun 11 13:50:02 PDT 2002


It works very well. but you have one spurious parenthesis. Here is a 
corrected version:

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

This version also returns first the upper left corner then the lower right 
corner in Latitude-Longitude order.

Thanks,
David Garnier 

Le Mardi 11 Juin 2002 22:40, Chris Hodgson a écrit :
> 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
>
> _______________________________________________
> 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