-
Notifications
You must be signed in to change notification settings - Fork 6
add DimensionalData extension #178
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
base: main
Are you sure you want to change the base?
Changes from all commits
56f51ae
8ec11d4
e799c08
d040a4c
d823118
34c6668
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ jobs: | |
fail-fast: false | ||
matrix: | ||
version: | ||
- '1.9' | ||
- '1.10' | ||
- '1' | ||
# - 'nightly' | ||
os: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module GeometryOpsDimensionalDataExt | ||
|
||
import DimensionalData as DD | ||
import GeometryOps as GO | ||
import GeoInterface as GI | ||
|
||
function GO.polygonize(A::DD.AbstractDimArray; dims=(DD.X(), DD.Y()), crs=GI.crs(A), kw...) | ||
lookups = DD.lookup(A, dims) | ||
bounds_vecs = if DD.isintervals(lookups) | ||
map(DD.intervalbounds, lookups) | ||
else | ||
@warn "`polygonsize` is not possible for `Points` sampling, as polygons cover space by definition. Treating as `Intervals`, but this may not be appropriate" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doesn't this just mean that the ring vertices are located at the points? That seems pretty exact... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm not sure I understand you. It's just saying that points don't cover any space so polygonizing them doesn't make sense There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was thinking of it more in a sense that the polygonizing operation is the concave hull of the set of points that satisfy There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, somehing else! |
||
map(lookups) do l | ||
asinghvi17 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
DD.intervalbounds(DD.set(l, DD.Intervals())) | ||
end | ||
end | ||
GO.polygonize(bounds_vecs..., DD.AbstractDimArray; crs, kw...) | ||
end | ||
|
||
|
||
end |
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.
What happens with the dims that aren't given (time etc)?
Uh oh!
There was an error while loading. Please reload this page.
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.
Yeah I haven't done that yet, this should be WIP.
But I image we make a feature collection with a feature for each slice, and put the lookup values as properties?
Otherwise return a DimArray of geoms of the remaining dimensions ?
Probably a single feature collection or table is most useful?
Uh oh!
There was an error while loading. Please reload this page.
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.
Actually this is a case for R style vector data cubes.
But we can just broadcast over the other dimensions and get a DimArray of X/Y geometries with time/etc dimensions.
We should be able to write that directly as a FeatureCollection with GeoJSON/ArchGDAL/Shapefile without any more work as long as we name the array
:geometry
.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.
Do we then want to add an assert here that the dims can only have length 2?