Skip to content
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

Make the quantization process optional #53

Merged
merged 2 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ After installing Rust, download this repository.
- `min`: Specify the minimum zoom level you want to output.
- `max`: Specify the maximum zoom level you want to output.
- `max-memory-mb`: Specify the number of MB of memory available for conversion.
- `quantize`: Perform quantization.
- `--gzip-compress`: The output 3D Tiles are compressed using gzip. The file extension dose not change.

In the repository root, the following commands can be executed.
Expand All @@ -45,7 +46,8 @@ point_tiler --input app/examples/data/sample.las \
--output-epsg 4979 \
--min 15 \
--max 18 \
--max-memory-mb 8192 \
--max-memory-mb 8193 \
--quantize \
--gzip-compress
```

Expand Down
14 changes: 13 additions & 1 deletion app/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use gzp::{
};
use itertools::Itertools as _;
use log::LevelFilter;
use pcd_exporter::gltf::generate_glb;
use pcd_parser::reader::csv::CsvPointReader;
use pcd_parser::reader::las::LasPointReader;
use pcd_parser::reader::PointReader;
Expand Down Expand Up @@ -74,6 +75,9 @@ struct Cli {
#[arg(long, default_value_t = 4 * 1024)]
max_memory_mb: usize,

#[arg(long)]
quantize: bool,

#[arg(long)]
gzip_compress: bool,
}
Expand Down Expand Up @@ -214,6 +218,7 @@ fn export_tiles_to_glb(
output_path: &Path,
min_zoom: u8,
max_zoom: u8,
quantize: bool,
gzip_compress: bool,
) -> std::io::Result<Vec<TileContent>> {
let mut all_tiles = Vec::new();
Expand Down Expand Up @@ -258,7 +263,12 @@ fn export_tiles_to_glb(

let glb_path = output_path.join(&tile_content.content_path);
fs::create_dir_all(glb_path.parent().unwrap()).unwrap();
let glb = generate_quantized_glb(decimated).unwrap();

let glb = if quantize {
generate_quantized_glb(decimated).unwrap()
} else {
generate_glb(decimated).unwrap()
};

if gzip_compress {
let file = File::create(glb_path).unwrap();
Expand Down Expand Up @@ -372,6 +382,7 @@ fn main() {
log::info!("min zoom: {}", args.min);
log::info!("max zoom: {}", args.max);
log::info!("max memory mb: {}", args.max_memory_mb);
log::info!("quantize: {}", args.quantize);
log::info!("gzip compress: {}", args.gzip_compress);

let start = std::time::Instant::now();
Expand Down Expand Up @@ -541,6 +552,7 @@ fn main() {
&output_path,
min_zoom,
max_zoom,
args.quantize,
args.gzip_compress,
)
.unwrap();
Expand Down