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

geopandas.overlay throws NotImplementedError #214

Open
michaelchin opened this issue Jul 3, 2024 · 6 comments
Open

geopandas.overlay throws NotImplementedError #214

michaelchin opened this issue Jul 3, 2024 · 6 comments
Assignees
Labels
bug Something isn't working medium

Comments

@michaelchin
Copy link
Contributor

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/./test_plot.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.

@michaelchin michaelchin added bug Something isn't working medium labels Jul 3, 2024
@brmather
Copy link
Collaborator

brmather commented Jul 8, 2024

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
Copy link
Contributor Author

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
Copy link
Contributor Author

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

@michaelchin
Copy link
Contributor Author

related to #226

@brmather
Copy link
Collaborator

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

@michaelchin
Copy link
Contributor Author

@bsim8882 this Issue is related to #226. The problem should go away once the #226 is done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working medium
Projects
None yet
Development

No branches or pull requests

3 participants