GPlates / gplately

GPlately is a Python package to interrogate tectonic plate reconstructions.
https://gplates.github.io/gplately/
GNU General Public License v2.0
56 stars 13 forks source link

geopandas.overlay throws NotImplementedError #214

Open michaelchin opened 3 months ago

michaelchin commented 3 months ago

It happened when I tried to plot COBs of Muller2016. The COBs contains polygon, multipolygon and linestring.

Traceback (most recent call last): File "/Users/mchin/workspace/gplately.git/tests-dir/unittest/./test_plot.py", line 107, in main(show=True) File "/Users/mchin/workspace/gplately.git/tests-dir/unittest/./testplot.py", line 83, in main getattr(gplot, f"plot{key}")( File "/Users/mchin/workspace/gplately.git/tests-dir/unittest/../../gplately/decorators.py", line 42, in wrapper return func_pointer(*args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/mchin/workspace/gplately.git/tests-dir/unittest/../../gplately/plot.py", line 818, in plot_continent_ocean_boundaries return self.plot_feature( ^^^^^^^^^^^^^^^^^^ File "/Users/mchin/workspace/gplately.git/tests-dir/unittest/../../gplately/decorators.py", line 42, in wrapper return func_pointer(args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/mchin/workspace/gplately.git/tests-dir/unittest/../../gplately/plot.py", line 698, in plot_feature return self._plot_feature(ax, partial(self.get_feature, feature), kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/mchin/workspace/gplately.git/tests-dir/unittest/../../gplately/plot.py", line 724, in _plot_feature gdf = _clean_polygons(data=gdf, projection=ax.projection) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/mchin/workspace/gplately.git/tests-dir/unittest/../../gplately/utils/plot_utils.py", line 392, in _clean_polygons data = data.overlay(rects, how="difference") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/mchin/micromamba/envs/gplately/lib/python3.11/site-packages/geopandas/geodataframe.py", line 2469, in overlay return geopandas.overlay( ^^^^^^^^^^^^^^^^^^ File "/Users/mchin/micromamba/envs/gplately/lib/python3.11/site-packages/geopandas/tools/overlay.py", line 274, in overlay raise NotImplementedError( NotImplementedError: df1 contains mixed geometry types.

brmather commented 2 months ago

Yes, I’ve encountered this error too. I think that it is a mistake to bundle different geometry types in with the plate model. My preference is that these COBs are modified and uploaded to Zenodo or alternatively convert all these polygons / multi polygons to line strings to enforce a uniform geometry type. We can discuss at the next GPlates meeting.

michaelchin commented 2 months ago

Yes, I’ve encountered this error too. I think that it is a mistake to bundle different geometry types in with the plate model. My preference is that these COBs are modified and uploaded to Zenodo or alternatively convert all these polygons / multi polygons to line strings to enforce a uniform geometry type. We can discuss at the next GPlates meeting.

Thanks Ben

michaelchin commented 2 months ago

The client seemed not unhappy about modifying their dataset to avoid this error. See the email with a subject "Muller2016 COB Terranes".

michaelchin commented 2 months ago

related to #226

brmather commented 3 weeks ago

Have we a solution to this? If I remember correctly, the consensus was to convert any polylines to polygons...?