cartopy
cartopy copied to clipboard
Use geometries.geoms to fix deprecation warning
Rationale
Fix deprecation warning from Shapely, in the vein of https://github.com/SciTools/cartopy/pull/1930.
Implications
None.
Fixes https://github.com/SciTools/cartopy/issues/1984.
Thank you, sorry I missed one :(
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
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!
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: https://github.com/SciTools/cartopy/issues/1303#issuecomment-619641832
I believe this was superseded by https://github.com/SciTools/cartopy/pull/1999 which should allow single geometries to be passed through now. Feel free to re-open if that is not the case.