[Community] Bounding Box and Minimum Bounding Rectangle

Sean Gillies sean.gillies at gmail.com
Tue Aug 3 02:03:50 EEST 2010


On Sun, Aug 1, 2010 at 2:53 PM, iomeneandrei <aborruso at tin.it> wrote:
>
> Hi all,
> I have read (not all) shapely documentation and I have found
> "object.envelope" method: it "returns a representation of the point or
> smallest rectangular polygon that contains the object."
>
> I have tested it, and it seems to me that it returns not the smallest
> rectangular polygon that contains the object, but the smallest rectangular
> polygon - whose sides are parallel to x and y axes - that contains the
> object. In other words the bounding box. Am I wrong?
>
> I have used this code:
> polygon = Polygon([(76, 840), (144, 962), (239, 929),(136, 784)])
> print polygon.envelope
>
> I obtain this:
> POLYGON ((76.0000000000000000 784.0000000000000000, 239.0000000000000000
> 784.0000000000000000, 239.0000000000000000 962.0000000000000000,
> 76.0000000000000000 962.0000000000000000, 76.0000000000000000
> 784.0000000000000000))
>
> I read this documentation page:
> http://gispython.org/shapely/docs/1.2/manual.html
>
> Thank you,
>
> a

You're right, the envelope's coordinates involve minimum and maximum
values of x and y. I'll update the manual to clear this up.

Cheers,

-- 
Sean


More information about the Community mailing list