[postgis-users] Re: From box2d to bbox

Obe, Regina robe.dnd at cityofboston.gov
Tue Oct 2 07:21:06 PDT 2007


It applies to box2d as well as all postgis geometries because the postgis geometries have auto casters that will cast them to bbox when using bbox functions.  So you actually don't even need to get the bbox to use those functions.
 
Simply doing this should work
 
UPDATE Mytable SET gbbox = st_xmin(the_geom) || ',' || st_ymin(the_geom) || ',' || st_xmax(the_geom) || ',' || st_ymax(the_geom)
 
--------------------------------------------------------------------------------------------------------------------
Now it just occurred to me that if you don't have the st_ versions of these functions, then you do need the BBOX.  So you would need to do
 
UPDATE Mytable SET gbbox = xmin(BOX2D(the_geom)) || ',' || ymin(BOX2D(the_geom))  || ',' || xmax(BOX2D(the_geom))  || ',' || ymax(BOX2D(the_geom))
 
 
The reason for that is that for some reason there is an xmax for box2d and one for box3d so what happens is that when applied to a geometry there is abiguity as to what the geometry should be cast to because the geom can be cast to the box2d or box3d so can use either function.
 
 
Hope that helps,
Regina
 
________________________________

From: postgis-users-bounces at postgis.refractions.net [mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Gustavo Ces
Sent: Tuesday, October 02, 2007 9:56 AM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] Re: From box2d to bbox


Hi Regina,
 
    What i was tried is
 
update Mytable set caja1=boundary(setsrid(box2d(the_geom),23029))
update Mytable set gbbox=x(pointN(caja1,1))||','||y(pointN(caja1,1))||','||x(pointN(caja1,3))||','||y(pointN(caja1,3))
 
Geoserver needs a parameter: bbox=xmin,ymin,xmax,ymax 
 
I don´t find the xmax function applied to a box2d ( only to box3d) and , is it.... i´ve just have read your last message! :)
 
Gus
    
 
 



-----------------------------------------
The substance of this message, including any attachments, may be
confidential, legally privileged and/or exempt from disclosure
pursuant to Massachusetts law. It is intended
solely for the addressee. If you received this in error, please
contact the sender and delete the material from any computer.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20071002/bb68236a/attachment.html>


More information about the postgis-users mailing list