[postgis-users] dimensions of a minimum bounding box

Emily Gouge egouge at refractions.net
Thu Jan 18 14:56:26 PST 2007


To compute the width, and heights you can use the xmin, xmax, ymin, and ymax functions in 
conjunction with the extent function:

select xmax(extent(geomfromtext('POLYGON((4 4, 10 4, 10 20, 4 20, 4 4))'))) -
	xmin (extent(geomfromtext('POLYGON((4 4,10 4, 10 20, 4 20, 4 4))'))) as xdiff,
        ymax(extent(geomfromtext('POLYGON((4 4, 10 4, 10 20, 4 20, 4 4))'))) -
         ymin(extent(geomfromtext('POLYGON((4 4, 10 4, 10 20, 4 20, 4 4))'))) as ydiff;


TECHER David wrote:
> use extent()
> 
> example
> 
> =# select extent(geometryfromtext('POLYGON((4 4,10 4,10 20,4 20,4 
> 4))',-1));
>     extent
> ----------------
> BOX(4 4,10 20)
> (1 ligne)
> 
> or for a table use
> 
> select extent(the_geom) from <yourtable>
> 
> temiz a écrit :
>> hello
>>
>> how can I compute dimensions of a minimum bounding box that surrounds 
>> a polygon ?
>> (width and length of a minimum bounding box)
>>
>> regards
>>
> 
> 
>     
> 
>     
>        
> ___________________________________________________________________________ 
> Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son 
> interface révolutionnaire.
> http://fr.mail.yahoo.com
> _______________________________________________
> 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