Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Differnt minimum_rotated_rectangle result between 1.8.5.post1 and 2.0.3 #2023

Open
sharon-br opened this issue Mar 17, 2024 · 0 comments
Open

Comments

@sharon-br
Copy link

Please note

If you are reporting an installation or module import issue, please note that
this project only accepts reports about problems with packages downloaded from
the Python Package Index. Conda users should take issues to one of the
following trackers:

Expected behavior and actual behavior.

minimum_rotated_rectangle on version 2.0.3 is still producing slightly different results from 1.8.5.post1.
I saw in the changelog that in versions later than 2.0.0 you went back to the old implementation if GEOS is old enough(which it is in the Pypi package), but the result is still a bit different for my given polygon.
The thing is, that unfortunately, I also depend on the order of the points returned.
I debugged the 2.0.3 code and it seems it does run the old logic, but the result is still not the same, maybe the GEOS envelope function returns a bit different result now?

Steps to reproduce the problem.

1.8.5.post1

import shapely.wkt
poly = shapely.wkt.loads('POLYGON ((26.848705291748047 76.95218658447266, 26.858497619628906 77.45209503173828, 26.859497619628907 77.45309503173829, 30.680748260498213 77.37773541259766, 34.502998901367185 77.30337579345704, 34.49760273742676 77.05292156982422, 34.493206573486326 76.80346734619141, 34.49220657348633 76.8024673461914, 26.848705291748047 76.95218658447266))')
print(poly.minimum_rotated_rectangle.wkt)
POLYGON ((34.502998901367185 77.30337579345705, 26.858517353420307 77.45311423297929, 26.848705291748047 76.95218658447267, 34.49318683969493 76.80244814495043, 34.502998901367185 77.30337579345705))

2.0.3

import shapely
poly = shapely.from_wkt('POLYGON ((26.848705291748047 76.95218658447266, 26.858497619628906 77.45209503173828, 26.859497619628907 77.45309503173829, 30.680748260498213 77.37773541259766, 34.502998901367185 77.30337579345704, 34.49760273742676 77.05292156982422, 34.493206573486326 76.80346734619141, 34.49220657348633 76.8024673461914, 26.848705291748047 76.95218658447266))')
print(poly.minimum_rotated_rectangle.wkt)
POLYGON ((26.848705291748047 76.95218658447267, 34.49318683969493 76.80244814495043, 34.502998901367185 77.30337579345704, 26.85851735342031 77.45311423297926, 26.848705291748047 76.95218658447267))

Operating system

Windows 10, Python 3.11

Shapely version and provenance

Shapely 1.8.5.post1, 2.0.3, both installed from pypi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant