Closed MarcoHannemann closed 1 year ago
Can you reproduce this error? The following code in waterbalance.py is responsible:
> section_line = LineString(MultiPoint(river_pnts.geometry.to_list()))
The LineString()
is not able to iterate over the MultiPoint object. When removing the conversion from List
to Multipoint
, the LineString is successfully built:
> section_line = LineString(river_pnts.geometry.to_list())
LINESTRING Z (476034.453 5758002.275 49.016, 475985.295 5757993.422 49.275,...>
Happens again here
I could identify the problem:
In the current master
environment, an old Version of Shapely==1.7.1
is used.
In the fresh environment I created using the current requirements.txt
, the updated shapely==2.0.1
is used.
Shapely had a major release with Version 2.0, that made some fundamental changes. With Shapely 2.0, Multi-part geometries such as MultiPoint
are not longer implemented as sequences, so that they are not iterable anymore. This information is available here: Migrating to Shapely 1.8 / 2.0.
To fix this, I would recommend to upgrade to Shapely 2.0.1 if there is no other functionality in the code that depends on an older version of Shapely. If that's not the case, I suggest to remove the Multipoint conversion as in the code above. I can confirm the code runs without problems after the change, @ErikNixdorf would have to check if the Linestring object stays the same.
Can you reproduce this error? The following code in waterbalance.py is responsible:
> section_line = LineString(MultiPoint(river_pnts.geometry.to_list()))
The
LineString()
is not able to iterate over the MultiPoint object. When removing the conversion fromList
toMultipoint
, the LineString is successfully built:> section_line = LineString(river_pnts.geometry.to_list()) LINESTRING Z (476034.453 5758002.275 49.016, 475985.295 5757993.422 49.275,...>
Happens again here
I got the same error after upgrading shapely on my local machine
I have yet to understand what the program does in detail, but want to make it run once first. Assumed #7 and #8 are fixed, the program will still not run and throws a TypeError related to some geometric object. Any idea what is happening here?