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

Failing set_precision collapse test with GEOS 3.10.1 #437

Closed
jorisvandenbossche opened this issue Nov 19, 2021 · 4 comments
Closed

Failing set_precision collapse test with GEOS 3.10.1 #437

jorisvandenbossche opened this issue Nov 19, 2021 · 4 comments

Comments

@jorisvandenbossche
Copy link
Member

From the conda-forge build (conda-forge/pygeos-feedstock#48) rebuilding pygeos with GEOS 3.10.1, one test is failing:

_______ test_set_precision_collapse[geometry8-keep_collapsed-expected8] ________

geometry = <pygeos.Geometry LINEARRING (0 0, 0.1 0, 0.1 0.1, 0 0.1, 0 0)>
mode = 'keep_collapsed'
expected = <pygeos.Geometry LINEARRING (0 0, 0 0, 0 0, 0 0, 0 0)>

....

    def test_set_precision_collapse(geometry, mode, expected):
        """Lines and polygons collapse to empty geometries if vertices are too close"""
        actual = pygeos.set_precision(geometry, 1, mode=mode)
        if pygeos.geos_version < (3, 9, 0):
            # pre GEOS 3.9 has difficulty comparing empty geometries exactly
            # normalize and compare by WKT instead
            assert pygeos.to_wkt(pygeos.normalize(actual)) == pygeos.to_wkt(
                pygeos.normalize(expected)
            )
        else:
            # force to 2D because GEOS 3.10 yields 3D geometries when they are empty.
>           assert_geometries_equal(pygeos.force_2d(actual), expected)
E           AssertionError: 
E           Geometries are not equal:
E           
E           Not equal to tolerance 1e-07
E            x: array(<pygeos.Geometry LINESTRING (0 0, 0 0, 0 0)>, dtype=object)
E            y: array(<pygeos.Geometry LINEARRING (0 0, 0 0, 0 0, 0 0, 0 0)>, dtype=object)
@jorisvandenbossche
Copy link
Member Author

cc @pramsey there is one related change in GEoS 3.10.1: libgeos/geos@14f0a69, although I don't see how that would cause a LinearRing to become a LineString instead

@caspervdw
Copy link
Member

This is expected behaviour from GEOS. The test in pygeos has been fixed in #419; I guess we just need to push the next release.

@caspervdw
Copy link
Member

Closing as the next release is tracked by #429

@jorisvandenbossche
Copy link
Member Author

Sorry, I actually checked if it was already changed on master, not sure how I missed this :)

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

2 participants