-
Notifications
You must be signed in to change notification settings - Fork 84
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
improve polygon coordinate handling #506
base: main
Are you sure you want to change the base?
Conversation
earthaccess/search.py
Outdated
def polygon( | ||
self, | ||
coordinates: Union[ | ||
shapely.geometry.polygon.Polygon, str, bytes, List[Tuple[str, str]] |
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.
shapely.geometry.polygon.Polygon, str, bytes, List[Tuple[str, str]] | |
shapely.geometry.base.BaseGeometry, str, bytes, List[Tuple[str, str]] |
I think since the rest of the implementation works of off the BaseGeometry, we could just use that here as well. We probably want to add some tests with different geometries and especially a clockwise vs couterclockwise ones
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 (583de40). Will think about/work on tests later this week/next week.
|
||
if isinstance(coordinates, shapely.geometry.base.BaseGeometry): | ||
geom = coordinates | ||
elif isinstance(coordinates, list): |
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.
Using list
is too restrictive. This should likely be Sequence
.
As detailed/explained/requested in #504:
shapely
geometry, WKT strings, and WKB geometriesshapely>=2.0.0
as a dependency topyproject.toml
📚 Documentation preview 📚: https://earthaccess--506.org.readthedocs.build/en/506/