Reputation: 7255
I have a geopandas dataframe that looks like the following
gdf.head()
geometry raster_val diss
0 POLYGON ((2.50553 49.10338, 2.50553 49.09506, ... 33.299999 1
1 POLYGON ((2.50553 49.09506, 2.50553 49.08673, ... 33.790001 1
2 POLYGON ((2.52218 49.09506, 2.52218 49.08673, ... 34.000000 1
3 POLYGON ((2.14760 49.07009, 2.14760 49.06176, ... 33.180000 1
4 POLYGON ((2.02274 49.06176, 2.02274 49.05344, ... 33.459999 1
I am trying to dissolve the POLYGONS
based on the column diss
gdf_diss = gdf.dissolve(by='diss')
but I get the following error:
GEOSException: IllegalArgumentException: Argument must be Polygonal or LinearRing
Upvotes: 5
Views: 1903
Reputation: 2935
I solved this by uninstalling pygeos
and installing Rtree
.
Compatibility note: Rtree has a different interface for the spatial_index .nearest()
query, so if you change dependencies and use that method, you must modify the signature. (Source)
Upvotes: 5
Reputation: 97
TL;DR - create a new environment, you likely installed something that bumped a version that made GEOS freak out.
This happened to me when I installed PyGEOS to take advantage of sjoin_nearest, requiring PyGEOS>0.10. I think I did that with pip which was a bad idea. I also install Cython and then networkx-metis with pip in a conda environment. I saw a few other posts outside of Stack Overflow about being an issue with the GEOS installation. Creating a new conda environment - including with Cycthon and networkx-metis - worked for me.
As for the root cause, I don't know.
Upvotes: 2