-
Notifications
You must be signed in to change notification settings - Fork 22
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
Update geo-traits #839
Update geo-traits #839
Conversation
if let Some(coord) = point.coord() { | ||
self.push_coord(&coord); | ||
} else { | ||
self.push([f64::NAN; D]); |
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'm completely out of my depth with geoarrow, but this appears a little awkward. Does the push_point
method even make sense anymore?
edit: as in, does it even need to exist?
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.
It's a little awkward, and potentially could be refactored in the future/moved to the point builder, but at some level there needs to be a conversion between empty points and the GeoArrow representation of those, which is with NAN values.
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 guess this comes down to my unfamiliarity with geoarrow.
So it sounds like a PointArray
needs to have an element in its CoordBuffer
for each point, even if that point is POINT EMPTY
.
Is the validity: NullBuffer
used to encode which coords correspond to POINT EMPTY
?
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.
So it sounds like a
PointArray
needs to have an element in itsCoordBuffer
for each point, even if that point isPOINT EMPTY
.
Correct.
The raw layout for a 2D point array with 4 points is:
[0, 2, 4, 5, NaN, NaN, 10, 2]
This translates to
Point(0, 2),
Point(4, 5),
Point EMPTY,
Point(10, 2)
Is the
validity: NullBuffer
used to encode which coords correspond toPOINT EMPTY
?
No... With GeoArrow we have three states of geometry:
null
: this is a row that does not have a geometryempty
: this row has a geometry but its geometry is empty (e.g. as a result of an empty intersection)- valid and non-empty: a standard geometry
The validity: NullBuffer
encodes the first of those. Every Arrow array has an optional nullability buffer, and that can say "this row is null".
When that validity buffer says that a row is valid, then we can look into the encoded geometry buffer, but it's still possible for that encoded geometry to be empty.
So for a 2D point, the encoding is one of these three states:
null
: validity buffer indicates value is null. For a point array the memory still needs to be reserved so that the offsets of future points are correct, but the values of that point's coordinates are undefined.empty
: validity buffer indicates not null. But all values aref64::NAN
.valid
: validity buffere not null, values are notf64::NAN
.
Update for georust/geo@
4764343
(#1157)