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

FIX #1836 - polylabel runs into infinite loop with tiny polygon #1843

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

djm93dev
Copy link

@djm93dev djm93dev commented Jun 26, 2023

I believe this should fix issue #1836

@jorisvandenbossche
Copy link
Member

Thanks for the PR! And sorry for the slow reply .. Could you add a test for this? (I think you can take the example from the bug report for that, and add a test based on that in test_polylabel.py)

@jorisvandenbossche
Copy link
Member

And it also seems to actually change the result (failing test, didn't look further into how the result is different):

    def test_polylabel(self):
        """
        Finds pole of inaccessibility for a polygon with a tolerance of 10
    
        """
        polygon = LineString(
            [(0, 0), (50, 200), (100, 100), (20, 50), (-100, -20), (-150, -200)]
        ).buffer(100)
        label = polylabel(polygon, tolerance=10)
        expected = Point(59.35615556364569, 121.8391962974644)
>       assert expected.equals_exact(label, 1e-6)
E       assert False
E        +  where False = <bound method BaseGeometry.equals_exact of <POINT (59.356 121.839)>>(<POINT (57.906 108.751)>, 1e-06)
E        +    where <bound method BaseGeometry.equals_exact of <POINT (59.356 121.839)>> = <POINT (59.356 121.839)>.equals_exact

shapely/tests/legacy/test_polylabel.py:21: AssertionError

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

Successfully merging this pull request may close these issues.

None yet

2 participants