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

Use geometries.geoms to fix deprecation warning #1985

Conversation

chowington
Copy link

@chowington chowington commented Jan 14, 2022

Rationale

Fix deprecation warning from Shapely, in the vein of #1930.

Implications

None.

Fixes #1984.

@akrherz
Copy link
Contributor

akrherz commented Jan 14, 2022

Thank you, sorry I missed one :(

@chowington
Copy link
Author

chowington commented Jan 15, 2022

No prob!

Unfortunately it looks like some tests are failing. Maybe the fix isn't as simple as I'd thought. I'm not actually that familiar with this package (I'm not using it myself), so someone else (@akrherz?) may need to look into it

@rcomer
Copy link
Member

rcomer commented Jan 16, 2022

According to the docstring, the class expects a collection of geometries, so the tests are passing tuples and lists. It seems reasonable to me that a user might want to pass a single geometry e.g. via GeoAxes.add_geometries. One option might be to check whether geometries is a shapely geometry object and turn it into a single element tuple before the line that is throwing the warning.

Disclaimer: I am not a Cartopy developer so have no authority here. Just making a suggestion!

@greglucas
Copy link
Contributor

I think @rcomer is on the right track. I think that suggestion would also help some other cases too with the pluralization confusion. See here for a possible starting implementation: #1303 (comment)

@greglucas
Copy link
Contributor

I believe this was superseded by #1999 which should allow single geometries to be passed through now. Feel free to re-open if that is not the case.

@greglucas greglucas closed this Aug 21, 2022
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.

Shapely deprecation warning from ShapelyFeature class
4 participants