need max rectangle coordinates from rectilinear polygon #1860
Unanswered
Amir4python
asked this question in
Q&A
Replies: 3 comments 4 replies
-
Maybe you can try the last two functions in https://shapely.readthedocs.io/en/stable/constructive.html. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Beta Was this translation helpful? Give feedback.
1 reply
-
[image: image.png]
the white space is the the polygon, from that white polygon, i need to max
area covered rectangle that covers most of the white space., in Landscape
or portrait or Both.
…On Wed, 11 Oct 2023 at 04:15, Mike Taves ***@***.***> wrote:
If you define a "max" rectangle that is aligned to the coordinate system,
this can be built with the .bounds attribute:
import shapelyfrom shapely.geometry import box
geom = shapely.from_wkt("POLYGON ((0 0, -50 86.6025, 123.20508 186.6025, 173.205 100, 0 0))")
box(*geom.bounds)# <POLYGON ((173.205 0, 173.205 186.602, -50 186.602, -50 0, 173.205 0))>
blue is input geom and red is the max bounds rectangle:
[image: image]
<https://user-images.githubusercontent.com/895458/274082278-0061f9b1-ca22-4d16-9608-8b27dfc64fc6.png>
or re-evaluate the minimum rotated rectangle
shapely.minimum_rotated_rectangle(geom)# <POLYGON ((-50 86.602, 0 0, 173.205 100, 123.205 186.603, -50 86.602))>
which is *almost* the same geometry (there are minor differences due the
algorithm), since the input was already rectangular.
—
Reply to this email directly, view it on GitHub
<#1860 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AOLNQ76G26VFE5TX3JKJBCTX6XFYBAVCNFSM6AAAAAA3BYUJWOVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM3TENBWGYYTK>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
i have sequence of coordinates of a polygon, the polygon has only straight edges no curved edges. we want to find the maximum rectangle that can cover most of the polygon area.
Beta Was this translation helpful? Give feedback.
All reactions