-
Notifications
You must be signed in to change notification settings - Fork 0
Spatial Indexing #3
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
Merged
Merged
Changes from all commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
40deaa9
Initial spatial index implementation
ryanstocks00 23b1198
Added non const offsets method
ryanstocks00 b731146
Fixing bugs with point format 14 boundary updating
ryanstocks00 ffb9185
Reading subset of chunks from spatial index
ryanstocks00 78f13d0
Write with chunks
ryanstocks00 c7bc94a
Bit of cleanup
ryanstocks00 6540489
Merge branch 'main' into spatial_index
ryanstocks00 f5d111a
MIT License
ryanstocks00 5792e80
Remove redundant casts
ryanstocks00 6dfb768
Minor fixes to spatial index test
ryanstocks00 a5266ed
Make constructor explicit
ryanstocks00 c5caf70
Fix redundant cast warnings
ryanstocks00 70be227
Remove tbb dependency
ryanstocks00 f86196c
Update clang warnings
ryanstocks00 cbe12bf
Fix unaligned reads
ryanstocks00 3f7a79c
Add parallel reduction
ryanstocks00 69a205a
Move pragma pack
ryanstocks00 a97a617
Minor warning fixes
ryanstocks00 ea72478
Remove unused parallel headers
ryanstocks00 cfe0636
Clean up includes
ryanstocks00 8525dad
Parallel chunk subset read
ryanstocks00 640b377
Correct packing
ryanstocks00 f7e7b59
Move project call earlier
ryanstocks00 500b3db
Update src/utilities/printing.hpp
ryanstocks00 607a28f
Update src/utilities/assert.hpp
ryanstocks00 e067be2
Update src/las_writer.hpp
ryanstocks00 65a32a2
Update src/las_writer.hpp
ryanstocks00 44be0fe
Update src/utilities/printing.hpp
ryanstocks00 de0c2f5
Cleanup import orders
ryanstocks00 f4f1980
Better dealing with null terminations
ryanstocks00 324865b
Fixing span ref passing to stream layers
ryanstocks00 f287385
Streaming point copy without spatial index
ryanstocks00 b673d07
Move int32_to_double
ryanstocks00 1386e94
Cleanup asserts and printing
ryanstocks00 c486246
Minor cleanup and laszip spatial index test
ryanstocks00 72f5728
Minor fixes
ryanstocks00 74a87e4
Minor fixes
ryanstocks00 a9c92bb
Clean up error handling
ryanstocks00 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| /* | ||
| * SPDX-FileCopyrightText: (c) 2025-2026 Trailblaze Software, all rights reserved | ||
| * SPDX-License-Identifier: MIT | ||
| */ | ||
|
|
||
| #include <cmath> | ||
| #include <fstream> | ||
| #include <iomanip> | ||
| #include <iostream> | ||
| #include <string> | ||
|
|
||
| #include "las_reader.hpp" | ||
| #include "spatial_index.hpp" | ||
| #include "utilities/assert.hpp" | ||
| #include "utilities/printing.hpp" | ||
| #include "vlr.hpp" | ||
|
|
||
| using namespace laspp; | ||
|
|
||
| int main(int argc, char* argv[]) { | ||
|
Check warning on line 20 in apps/inspect_vlrs.cpp
|
||
| if (argc != 2) { | ||
| std::cerr << "Usage: " << argv[0] << " <laz_file>" << std::endl; | ||
| return 1; | ||
| } | ||
|
|
||
| std::string filename = argv[1]; | ||
| std::filesystem::path file_path(filename); | ||
| LASReader reader(file_path); | ||
|
|
||
| std::cout << "=== VLRs ===" << std::endl; | ||
| const auto& vlrs = reader.vlr_headers(); | ||
| for (size_t i = 0; i < vlrs.size(); ++i) { | ||
| const auto& vlr = vlrs[i]; | ||
| std::cout << "VLR " << i << ":" << std::endl; | ||
| std::cout << indented(vlr, " "); | ||
| std::cout << " Is LAZ VLR: " << (vlr.is_laz_vlr() ? "yes" : "no") << std::endl; | ||
| std::cout << " Is LAStools spatial index VLR: " | ||
| << (vlr.is_lastools_spatial_index_vlr() ? "yes" : "no") << std::endl; | ||
| std::cout << std::endl; | ||
| } | ||
|
|
||
| std::cout << "=== EVLRs ===" << std::endl; | ||
| const auto& evlrs = reader.evlr_headers(); | ||
| for (size_t i = 0; i < evlrs.size(); ++i) { | ||
| const auto& evlr = evlrs[i]; | ||
| std::cout << "EVLR " << i << ":" << std::endl; | ||
| std::cout << indented(evlr, " "); | ||
| std::cout << " Is LAZ VLR: " << (evlr.is_laz_vlr() ? "yes" : "no") << std::endl; | ||
| std::cout << " Is LAStools spatial index EVLR: " | ||
| << (evlr.is_lastools_spatial_index_evlr() ? "yes" : "no") << std::endl; | ||
|
|
||
| // If it's a LAStools spatial index, show more details | ||
| if (evlr.is_lastools_spatial_index_evlr()) { | ||
| LASPP_ASSERT(reader.has_lastools_spatial_index(), | ||
| "Failed to load LAStools spatial index from EVLR."); | ||
| std::cout << "Spatial index: " << std::endl; | ||
| const auto& index = reader.lastools_spatial_index(); | ||
| const auto& quadtree = index.quadtree_header(); | ||
|
|
||
| std::cout << " Spatial index header:" << std::endl; | ||
| std::cout << indented(quadtree, " "); | ||
| std::cout << " Number of cells: " << index.num_cells() << std::endl; | ||
|
|
||
| // Show cell details | ||
| size_t total_intervals = 0; | ||
| for (const auto& [cell_index, cell] : index.cells()) { | ||
| total_intervals += cell.intervals.size(); | ||
| } | ||
| std::cout << " Total intervals: " << total_intervals << std::endl; | ||
| std::cout << " Average intervals per cell: " << std::fixed << std::setprecision(1) | ||
| << (index.num_cells() > 0 ? static_cast<double>(total_intervals) / | ||
| static_cast<double>(index.num_cells()) | ||
| : 0.0) | ||
| << std::endl; | ||
|
|
||
| // Show first few cells as examples | ||
| std::cout << indented(limited_map(index.cells(), 3), " ") << std::endl; | ||
| } | ||
| std::cout << std::endl; | ||
| } | ||
|
|
||
| if (reader.has_lastools_spatial_index()) { | ||
| const auto& spatial_index = reader.lastools_spatial_index(); | ||
| std::cout << "Loaded LAStools spatial index with " << spatial_index.num_cells() << " cells." | ||
| << std::endl; | ||
| std::cout << "Spatial index details:" << std::endl; | ||
| std::cout << indented(spatial_index, " ") << std::endl; | ||
| } | ||
|
|
||
| return 0; | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.