Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

mwtoews
Copy link
Member

@mwtoews mwtoews commented Mar 10, 2024

This fixes an issue while using to_wkt as a ufunc on an array with GEOS >= 3.9.0 with empty geometries. The issue (discovered with GH-2004) is that the WKT writer finishes sometimes too early while processing geometries.

For instance, using shapely 2.0.2 with GEOS 3.12.1 via conda-forge:

import shapely

empty_geoms = shapely.from_wkt(["POINT Z EMPTY", "POINT Z EMPTY"])
list(shapely.to_wkt(empty_geoms))
# ['POINT Z EMPTY', None]

It also seems that there could be a missing Py_XDECREF(*out);, but I'd appreciate someone with Python C API expertise to weight in.

This can be backported to maint-2.0 too.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 8219269271

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.3%) to 88.092%

Totals Coverage Status
Change from base Build 8168514474: 0.3%
Covered Lines: 2604
Relevant Lines: 2956

💛 - Coveralls

Copy link
Member

@jorisvandenbossche jorisvandenbossche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This looks correct to me now

@jorisvandenbossche jorisvandenbossche merged commit c439168 into shapely:main Mar 10, 2024
@mwtoews
Copy link
Member Author

mwtoews commented Mar 10, 2024

Backported to maint-2.0 with 5976300

@mwtoews mwtoews deleted the fix-wkt-empty-z branch March 10, 2024 22:13
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.

3 participants