Add point-cloud data-out methods (metadata / numpy / dataframe) - #208
Merged
Conversation
Add PointCloud.metadata(), to_numpy(), and to_dataframe() that page over the tiled point-cloud data endpoints and assemble points in memory, mirroring the Grid chunk-reader pattern. The binary transport is the fast path; a module-level _decode_point_cloud_tile() splits the contiguous little-endian column blocks described by the X-Data-* headers. metadata() drives tile iteration, and lod / classes / columns selections are forwarded to the endpoints. Tests cover offline binary decoding with synthetic bytes, the CSV query helper, completion guards, and live 3DEP reads validated value-for-value against an independent reassembly over the JSON tile endpoint.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds data-out to the
PointCloudclass, which previously had no way to read its points into memory (unlikeGrid.to_numpy/to_xarray). Mirrors theGridchunk-reader pattern, paging over the tiled point-cloud data endpoints added in the recent client regen.New public surface on
PointCloud:metadata()— the tile index (occupied tiles, columns/dtypes, coordinate encoding, per-LOD point counts) without downloading any points; drives tile iteration.to_numpy(lod=None, classes=None, columns=("X","Y","Z"), decode_coordinates=True)— pages over occupied tiles and stacks the requested columns into an(N, k)float64 array. Defaults to decoded XYZ coordinates.to_dataframe(lod=None, classes=None, columns=None, decode_coordinates=True)— one row per point, one column per stored attribute (all columns by default).The binary transport is the fast path: a module-level
_decode_point_cloud_tile()splits the contiguous little-endian column blocks described by theX-Data-*headers (bypassing the generated parser, which casts the binary body tostr, exactly asGriddoes for its binary chunks).lod/classes/columnsselections are forwarded to the endpoint.X/Y/Zare decoded from stored scaled integers to CRS coordinates via the metadatascales/offsets.Tests
All 33 tests in
tests/v2/test_point_clouds.pypass against the live API.blackandflake8are clean.Depends on #195 (client regen, already merged to main).
Closes #199