-
Notifications
You must be signed in to change notification settings - Fork 156
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
Make polygon fixture data valid #1472
Conversation
For from shapely import get_coordinates
from itertools import chain
geom = gs[:9]
polys = geom[geom.apply(lambda x: isinstance(x, (MultiPolygon, Polygon)))]
coords = list(chain(polys.apply(get_coordinates)))
xy = list(chain(*coords))
x = [c[0] for c in coords]
y = [c[1] for c in coords] |
CI is blocked waiting for #1475 |
polys_list = gs[gs.apply(lambda x: isinstance(x, (MultiPolygon, Polygon)))] | ||
polys = list( | ||
chain(polys_list.apply(get_coordinates)) | ||
) # flatten multigeometries | ||
coords_list = list(chain(*polys)) # flatten geometries | ||
xy_interleaved = list(chain(*coords_list)) # flatten coordinates | ||
x = xy_interleaved[::2] | ||
y = xy_interleaved[1::2] |
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.
Not something we need to fix in this PR, but it would be nice to abstract this into a helper.
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.
Agree, there is a lot of repetition.
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.
Working on this.
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.
Done in 5488ac6
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.
I assume you mean 1e96184? This looks much cleaner. Thanks!
I merged in the upstream to get CI fixes from #1475. |
Thanks. I take it you approve this PR? :) |
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.
Looks good to me.
/merge |
Description
Fixes #1471. Fixes the invalid polygon geometry and improves geometry slicing tests to not depend on hard-coded vertex positions that are also hard-coded in the fixture.
Checklist