Re: [postgis-users] Minimum Bounding Rectangle

2012-06-19 Thread Madison Shaw
Thanks Martin - Ill have a look at JTS - otherwise I think I will be
implemeting it based on the steps Brent mentions.

I believe ArcGIS 10 has a set of tool to create them as well - but
requires an info license.

Thanks everyone for the help :)

Madison




On 19 June 2012 04:39, Martin Davis mtncl...@telus.net wrote:
 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@postgis.refractions.net
 http://postgis.refractions.net/mailman/listinfo/postgis-users




 ___
 postgis-users mailing list
 postgis-users@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


 ___
 postgis-users mailing list
 postgis-users@postgis.refractions.net
 http://postgis.refractions.net/mailman/listinfo/postgis-users
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] Minimum Bounding Rectangle

2012-06-19 Thread Brent Fraser

Madison,

  My algorithm will produce A rotated rectangle, but not necessarily 
THE minimum bounding rectangle.  My focus was on finding the length of a 
polygon, then the width perpendicular to that length (and my algorithm 
is ok for that).  JTS's getMinimumRectangle is the approach to use for a 
rotated MBR. Think of a square polygon; my approach will result in a 
larger square rotated 45 degrees from the original, whereas JTS will 
produce a square of the same size and orientation as the original (as 
would be expected for a rotated MBR).


  Sorry for the misdirection...

Best Regards,
Brent Fraser

On 6/19/2012 3:42 AM, Madison Shaw wrote:

Thanks Martin - Ill have a look at JTS - otherwise I think I will be
implemeting it based on the steps Brent mentions.

I believe ArcGIS 10 has a set of tool to create them as well - but
requires an info license.

Thanks everyone for the help :)

Madison




On 19 June 2012 04:39, Martin Davis mtncl...@telus.net wrote:

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@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users




___
postgis-users mailing list
postgis-users@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



___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users





___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] Minimum Bounding Rectangle

2012-06-18 Thread Brent Fraser

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@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users





___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] Minimum Bounding Rectangle

2012-06-18 Thread Brent Fraser

Regina,

Yep, I used ST_LongestLine to confirm my length calc.  I didn't think my 
PostGIS fu was good enough to create a Postgresql function to find the 
width and construct a rotated bbox (maybe some day)...


Thanks!

Best Regards,
Brent Fraser

On 6/18/2012 11:28 AM, Paragon Corporation wrote:

It's on my todo.  well first step of my todo anyway.

http://trac.osgeo.org/postgis/ticket/1332

Brent -- thinking of your idea

Have you tried using ST_LongestLine?
http://www.postgis.org/documentation/manual-svn/ST_LongestLine.html

I'm hoping to get back to this ticket soon but tied up with other things.

Thanks,
Regina
http://www.postgis.us

  


-Original Message-
From: postgis-users-boun...@postgis.refractions.net
[mailto:postgis-users-boun...@postgis.refractions.net] On
Behalf Of Brent Fraser
Sent: Monday, June 18, 2012 12:37 PM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] Minimum Bounding Rectangle

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@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users




___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users



___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users





___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] Minimum Bounding Rectangle

2012-06-18 Thread Martin Davis

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@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users





___
postgis-users mailing list
postgis-users@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



___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] Minimum Bounding Rectangle

2012-06-15 Thread Madison Shaw
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@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users