Skip to content
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
2 changes: 1 addition & 1 deletion crates/total-viewsheds/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ pub struct Compute {
)]
pub process: Vec<Process>,

/// The input DEM file. Currently only `.hgt` files are supported.
/// The input DEM file. Can be of any file type supported by GDAL.
#[arg(value_name = "Path to the DEM file")]
pub input: std::path::PathBuf,

Expand Down
6 changes: 5 additions & 1 deletion crates/total-viewsheds/src/pre_process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ pub fn create_biggest_tvs_subgrid(config: &crate::config::Compute) -> Result<Has
let neighbourhood_size = config
.only_save_biggest_viewsheds
.context("Must specify --only-save-biggest-viewsheds")?;
let dataset = gdal::Dataset::open(&config.input)?;
let tvs_source_path = config

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit confused here.... Can you have both a --input and a --tvs_source_path?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. --input is for the raw elevation data, --tvs-source-path is for providing a heatmap so that the neighbourhood culling algorithm can select the best viewsheds.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense

.tvs_source_path
.clone()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does .clone() do some sort of path validation?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the clone is just prevent a partial borrow of config.

.context("Must specify --tvs-source-path")?;
let dataset = gdal::Dataset::open(&tvs_source_path)?;
let hashmap = find_biggest_total_surfaces(&dataset, i64::from(neighbourhood_size))?;

Ok(hashmap)
Expand Down
Loading