-
Notifications
You must be signed in to change notification settings - Fork 14
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
Extract grid cells as shapely (or spherely) geometries #10
Comments
|
Example with H3: https://medium.com/@jesse.b.nestler/how-to-convert-h3-cell-boundaries-to-shapely-polygons-in-python-f7558add2f63 (not sure it uses shapely's 2.0 vectorized geometry creation functions, though). |
After thinking more about it, I would lean towards ds.assign_coords(
cell_center=ds.dggs.extract_cell_centroids(),
cell_bounds=ds.dggs.extract_cell_boundaries(),
) |
if we go with that API, you could even remove the As for |
Agreed.
I think we should always recompute. It is better letting users figure out whether they need to call
I haven't checked that, but I assume that most DGGS backends deal with lat/lon coordinates directly instead of shapely Point, so supporting only the latter would mean a wasteful creation of shapely objects + extraction of coordinates for those who do not need shapely. |
oh, I was not suggesting to drop the existing computation of lat / lon values from cell ids, just wondering if given a point variable you'd be able to transform to lat / lon variables. |
Ah yes, not sure if there's a specific function in xvec, but using |
I'd imagine we'd be able to extend |
how much should we care about the different terminologies? Like, we've been talking about "cells" and "cell ids", but the OGC working group tends to talk about "zones" and "zonal ids". We could in theory make one an alias (or a thin wrapper) of the other, but we could also just follow H3 and stick with "cells". In any case, I think having a bunch of |
should have been closed by #30, which puts the polygons into |
We could add a
Dataset.dggs.assign_boundaries()
that would create and assign a new coordinate ofshapely.Polygon
objects (and/or laterspherely.Polygon
objects when it is ready) of grid cell boundaries from the cell ids indexed coordinate.This would be a nice complement to
Dataset.dggs.assign_latlon_coords()
(that we could maybe rename toassign_centers_latlon()
for consistency). We could also have aDataset.dggs.assign_centers()
that would createshapely.Point
(orspherely.Point
) objects.This would be useful for interoperability with xvec, for plotting, etc.
The text was updated successfully, but these errors were encountered: