-
Notifications
You must be signed in to change notification settings - Fork 364
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
Fix crash #1090
Fix crash #1090
Conversation
lib/cartopy/crs.py
Outdated
len(linear_ring.coords) > 2] | ||
processed_ls = [sgeom.LinearRing(linear_ring) | ||
for linear_ring in processed_ls | ||
if len(linear_ring.coords) > 2 and linear_ring.is_valid] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E501 line too long (80 > 79 characters)
lib/cartopy/crs.py
Outdated
linear_rings = [sgeom.LinearRing(line) for line in processed_ls] | ||
processed_ls = [sgeom.LinearRing(linear_ring) | ||
for linear_ring in processed_ls | ||
if len(linear_ring.coords) > 2 and linear_ring.is_valid] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E501 line too long (80 > 79 characters)
lib/cartopy/crs.py
Outdated
linear_rings = [sgeom.LinearRing(line) for line in processed_ls] | ||
linear_rings = [sgeom.LinearRing(linear_ring) | ||
for linear_ring in processed_ls | ||
if len(linear_ring.coords) > 2 and linear_ring.is_valid] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E501 line too long (80 > 79 characters)
Don't try to cast to a LinearRing if the source geometry is not valid.
Taken from example posted by @akrherz
@pelson Looks like this is all green. |
Looks good to me. I've no idea of the performance implications, but happy with the correctness implications 👍 |
Fixes crash with Shapely due to invalid LineString. Seems to be fine just to make sure we have a valid geometry before converting it.
Alternate to #1047 .