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

Fix crash #1090

Merged
merged 2 commits into from
Jul 17, 2018
Merged

Fix crash #1090

merged 2 commits into from
Jul 17, 2018

Conversation

dopplershift
Copy link
Contributor

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 .

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]

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)

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]

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)

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]

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

@pelson Looks like this is all green.

@pelson
Copy link
Member

pelson commented Jul 17, 2018

Looks good to me. I've no idea of the performance implications, but happy with the correctness implications 👍

@pelson pelson merged commit 64aeab9 into SciTools:master Jul 17, 2018
@pelson pelson added this to the 0.17 milestone Jul 17, 2018
@dopplershift dopplershift deleted the fix-crash branch July 17, 2018 19:34
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.

3 participants