[postgis-users] Minimum Bounding Rectangle

Martin Davis mtnclimb at telus.net
Mon Jun 18 20:39:17 PDT 2012


JTS has a class for computing a Minimum Bounding Rectangle:

http://tsusiatsoftware.net/jts/javadoc/com/vividsolutions/jts/algorithm/MinimumDiameter.html

This may be in GEOS as well.

On 6/18/2012 9:36 AM, Brent Fraser wrote:
> Madison,
>
>   I went looking a few months ago, but could find nothing.  I wrote 
> some PHP to:
>     1. Find the length of the polygon (vertices farthest apart)
>     2. Find the width (based on vertices farthest from length line)
>     3. Build bounding box using length (with angle of the the length 
> line) and the width
>
> I'm still pondering the result when the input polygon is a square...
>
> But there should really be something like a "ST_ExtentRotated" or 
> "ST_RotatedBBox"  function in PostGIS.
>
> Best Regards,
> Brent Fraser
>
> On 6/15/2012 2:03 PM, Madison Shaw wrote:
>> Hi,
>>
>> I was wondering if any one could possibly offer some advice.
>>
>> I am wanting to calculate the area for a minimum bounding rectangle
>> for individual polygon features.  I know I can use st_envelope or
>> st_extent along with st_area but this doesn't quite give me the
>> results I am after.
>>
>> For example if the polygon was already a rectangle but was orientated
>> on an angle the bounding box area is much larger than the area of the
>> original rectangle, whereas I would like it to be the same value.  I
>> suppose what I am after is a convex hull but as a rectangle. Is this
>> possible?
>>
>> Any help is greatly appreciated.
>>
>> Cheers
>>
>> Madison
>> _______________________________________________
>> 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
>
>
> -----
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 2012.0.2179 / Virus Database: 2433/5077 - Release Date: 06/18/12
>
>



More information about the postgis-users mailing list