-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add a from_geo_json()
to Transformer
#7
Conversation
from_geo_json()
to Transformerfrom_geo_json()
to Transformer
3fc2ed8
to
cac329c
Compare
def to_polygons(obj: Geometry) -> TransformationResult:
"""Convert a geometry to a sequence of polygons.
:returns: a generator yielding the polygon sequence.
:raises: Exception
"""
if isinstance(obj, MultiPolygon):
for poly in obj.geoms:
yield poly
return
if isinstance(obj, Polygon):
yield obj
return
raise Exception(f"WKT: '{obj}' is not a Polygon or MultiPolygon") The Exception can be triggered by the GeoJSON as well. I feel like it is better to just remove |
Cannot for the life of me figure out the flake8 issue. Hashtag doesn't happen on my machine. But really, I don't know what's going on. |
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 minus the style stuff. We should fix that before its merged
cac329c
to
af0fcbb
Compare
af0fcbb
to
48076a2
Compare
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 except the indentation issue. I would support removing the WKT
from the error message.
Exception, | ||
match=r"WKT: 'POINT \(30 10\)' is not a Polygon or MultiPolygon", |
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.
These lines are indented an extra level.
Oh, you also should've bumped the version number in the pyproject.toml. Now it is out of sync with the version on the releases page: https://github.com/asfadmin/geo_extensions/blob/main/pyproject.toml |
CIRRUS-NISAR requires generating Spatial Extent from GeoJSON and not WKT as before.