Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
Updates
  • Loading branch information
jblindsay committed Jan 20, 2019
1 parent 0afd150 commit 3609a99
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 50 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

*This page is related to the stand-alone command-line program and Python scripting API for geospatial analysis, **WhiteboxTools**. If you are instead interested in the open-source GIS, **Whitebox GAT**, please see this [link](https://github.com/jblindsay/whitebox-geospatial-analysis-tools).*

The official WhiteboxTools User Manual can be found [at this link](https://jblindsay.github.io/wbt_book/index.html).

**Contents**

1. [Description](#1-description)
Expand Down
9 changes: 8 additions & 1 deletion src/tools/gis_analysis/construct_vector_tin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,14 @@ use std::f64;
use std::io::{Error, ErrorKind};
use std::path;

/// This tool creates a vector triangular irregular network (TIN) for a set of vector points.
/// This tool creates a vector triangular irregular network (TIN) for a set of vector points (`--input`)
/// using a 2D [Delaunay triangulation](https://en.wikipedia.org/wiki/Delaunay_triangulation) algorithm.
/// TIN vertex heights can be assigned based on either a field in the vector's attribute table (`--field`),
/// or alternatively, if the vector is of a z-dimension *ShapeTypeDimension*, the point z-values may be
/// used for vertex heights (`--use_z`). For LiDAR points, use the `LidarConstructVectorTIN` tool instead.
///
/// # See Also
/// `LidarConstructVectorTIN`
pub struct ConstructVectorTIN {
name: String,
description: String,
Expand Down
13 changes: 8 additions & 5 deletions src/tools/gis_analysis/create_hexagonal_vector_grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
This tool is part of the WhiteboxTools geospatial analysis library.
Authors: Dr. John Lindsay
Created: 15/09/2018
Last Modified: 13/10/2018
Last Modified: 20/01/2019
License: MIT
*/

Expand All @@ -19,8 +19,11 @@ use std::path;

/// This tool can be used to create a hexagonal vector grid. The extent of the hexagonal
/// grid is based on the extent of a user-specified base file (any supported raster format,
/// shapefiles, or LAS files). The user must also specify the origin of the grid (x and y
/// coordinates) and the hexagonal cell width.
/// shapefiles, or LAS files). The user must also specify the hexagonal cell width (`--width`)
/// and whether the hexagonal orientation (`--orientation`) is `horizontal` or `vertical`.
///
/// # See Also
/// `CreateRectangularVectorGrid`
pub struct CreateHexagonalVectorGrid {
name: String,
description: String,
Expand All @@ -39,7 +42,7 @@ impl CreateHexagonalVectorGrid {
let mut parameters = vec![];
parameters.push(ToolParameter {
name: "Input Base File".to_owned(),
flags: vec!["-i".to_owned(), "--input".to_owned()],
flags: vec!["-i".to_owned(), "--base".to_owned(), "--input".to_owned()],
description: "Input base file.".to_owned(),
parameter_type: ParameterType::ExistingFile(ParameterFileType::RasterAndVector(
VectorGeometryType::Any,
Expand Down Expand Up @@ -169,7 +172,7 @@ impl WhiteboxTool for CreateHexagonalVectorGrid {
keyval = true;
}
let flag_val = vec[0].to_lowercase().replace("--", "-");
if flag_val == "-i" || flag_val == "-input" {
if flag_val == "-i" || flag_val == "-input" || flag_val == "-base" {
input_file = if keyval {
vec[1].to_string()
} else {
Expand Down
13 changes: 8 additions & 5 deletions src/tools/gis_analysis/create_rectangular_vector_grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
This tool is part of the WhiteboxTools geospatial analysis library.
Authors: Dr. John Lindsay
Created: 15/09/2018
Last Modified: 13/10/2018
Last Modified: 20/01/2019
License: MIT
*/

Expand All @@ -19,8 +19,11 @@ use std::path;

/// This tool can be used to create a rectangular vector grid. The extent of the rectangular
/// grid is based on the extent of a user-specified base file (any supported raster format,
/// shapefiles, or LAS files). The user must also specify the origin of the grid (x and y
/// coordinates) and the grid cell width and height.
/// shapefiles, or LAS files). The user must also specify the origin of the grid (`--xorig`
/// and `--yorig`) and the grid cell width and height (`--width` and `--height`).
///
/// # See Also
/// `CreateHexagonalVectorGrid`
pub struct CreateRectangularVectorGrid {
name: String,
description: String,
Expand All @@ -39,7 +42,7 @@ impl CreateRectangularVectorGrid {
let mut parameters = vec![];
parameters.push(ToolParameter {
name: "Input Base File".to_owned(),
flags: vec!["-i".to_owned(), "--input".to_owned()],
flags: vec!["-i".to_owned(), "--base".to_owned(), "--input".to_owned()],
description: "Input base file.".to_owned(),
parameter_type: ParameterType::ExistingFile(ParameterFileType::RasterAndVector(
VectorGeometryType::Any,
Expand Down Expand Up @@ -186,7 +189,7 @@ impl WhiteboxTool for CreateRectangularVectorGrid {
keyval = true;
}
let flag_val = vec[0].to_lowercase().replace("--", "-");
if flag_val == "-i" || flag_val == "-input" {
if flag_val == "-i" || flag_val == "-input" || flag_val == "-base" {
input_file = if keyval {
vec[1].to_string()
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/tools/hydro_analysis/average_flowpath_slope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ impl WhiteboxTool for AverageFlowpathSlope {
];
let (mut row, mut col): (isize, isize);
let (mut row_n, mut col_n): (isize, isize);
let mut val: i64;
let mut val: i32;
let mut dir: i8;
let mut length: f64;
let mut z_mean: f64;
Expand Down
11 changes: 10 additions & 1 deletion src/tools/lidar_analysis/lidar_construct_vector_tin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,16 @@ use std::sync::mpsc;
use std::sync::{Arc, Mutex};
use std::{env, f64, fs, path, thread};

/// Creates a vector triangular irregular network (TIN) fitted to LiDAR points.
/// This tool creates a vector triangular irregular network (TIN) for a set of LiDAR points (`--input`)
/// using a 2D [Delaunay triangulation](https://en.wikipedia.org/wiki/Delaunay_triangulation) algorithm.
/// LiDAR points may be excluded from the triangulation operation based on a number of criteria,
/// include the point return number (`--returns`), point classification value (`--exclude_cls`), or
/// a minimum (`--minz`) or maximum (`--maxz`) elevation.
///
/// For vector points, use the `ConstructVectorTIN` tool instead.
///
/// # See Also
/// `ConstructVectorTIN`
pub struct LidarConstructVectorTIN {
name: String,
description: String,
Expand Down
81 changes: 44 additions & 37 deletions src/tools/lidar_analysis/lidar_elevation_slice.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
This tool is part of the WhiteboxTools geospatial analysis library.
Authors: Dr. John Lindsay
Created: June 2, 2017
Last Modified: February 14, 2018
Created: 02/06/2017
Last Modified: 20/01/2019
License: MIT
*/

Expand All @@ -13,6 +13,16 @@ use std::f64;
use std::io::{Error, ErrorKind};
use std::path;

/// This tool can be used to either extract or classify the elevation values (z) of LiDAR points within
/// a specified elevation range (slice). In addition to the names of the input and output LiDAR files
/// (`--input` and `--output`), the user must specify the lower (`--minz`) and upper (`--maxz`) bounds of
/// the elevation range. By default, the tool will only output points within the elevation slice, filtering
/// out all points lying outside of this range. If the `--class` parameter is used, the tool will operate
/// by assigning a class value (`--inclassval`) to the classification bit of points within the slice and
/// another class value (`--outclassval`) to those points falling outside the range.
///
/// # See Also
/// `LidarRemoveOutliers`, `LidarClassifySubset`
pub struct LidarElevationSlice {
name: String,
description: String,
Expand Down Expand Up @@ -186,48 +196,45 @@ impl WhiteboxTool for LidarElevationSlice {
if vec.len() > 1 {
keyval = true;
}
if vec[0].to_lowercase() == "-i" || vec[0].to_lowercase() == "--input" {
if keyval {
input_file = vec[1].to_string();
let flag_val = vec[0].to_lowercase().replace("--", "-");
if flag_val == "-i" || flag_val == "-input" {
input_file = if keyval {
vec[1].to_string()
} else {
input_file = args[i + 1].to_string();
}
} else if vec[0].to_lowercase() == "-o" || vec[0].to_lowercase() == "--output" {
if keyval {
output_file = vec[1].to_string();
args[i + 1].to_string()
};
} else if flag_val == "-o" || flag_val == "-output" {
output_file = if keyval {
vec[1].to_string()
} else {
output_file = args[i + 1].to_string();
}
} else if vec[0].to_lowercase() == "-maxz" || vec[0].to_lowercase() == "--maxz" {
if keyval {
maxz = vec[1].to_string().parse::<f64>().unwrap();
args[i + 1].to_string()
};
} else if flag_val == "-maxz" {
maxz = if keyval {
vec[1].to_string().parse::<f64>().unwrap()
} else {
maxz = args[i + 1].to_string().parse::<f64>().unwrap();
}
} else if vec[0].to_lowercase() == "-minz" || vec[0].to_lowercase() == "--minz" {
if keyval {
minz = vec[1].to_string().parse::<f64>().unwrap();
args[i + 1].to_string().parse::<f64>().unwrap()
};
} else if flag_val == "-minz" {
minz = if keyval {
vec[1].to_string().parse::<f64>().unwrap()
} else {
minz = args[i + 1].to_string().parse::<f64>().unwrap();
}
} else if vec[0].to_lowercase() == "-class" || vec[0].to_lowercase() == "--class" {
args[i + 1].to_string().parse::<f64>().unwrap()
};
} else if flag_val == "-class" {
filter = false;
} else if vec[0].to_lowercase() == "-inclassval"
|| vec[0].to_lowercase() == "--inclassval"
{
if keyval {
in_class_value = vec[1].to_string().parse::<u8>().unwrap();
} else if flag_val == "-inclassval" {
in_class_value = if keyval {
vec[1].to_string().parse::<u8>().unwrap()
} else {
in_class_value = args[i + 1].to_string().parse::<u8>().unwrap();
}
} else if vec[0].to_lowercase() == "-outclassval"
|| vec[0].to_lowercase() == "--outclassval"
{
if keyval {
out_class_value = vec[1].to_string().parse::<u8>().unwrap();
args[i + 1].to_string().parse::<u8>().unwrap()
};
} else if flag_val == "-outclassval" {
out_class_value = if keyval {
vec[1].to_string().parse::<u8>().unwrap()
} else {
out_class_value = args[i + 1].to_string().parse::<u8>().unwrap();
}
args[i + 1].to_string().parse::<u8>().unwrap()
};
}
}

Expand Down

0 comments on commit 3609a99

Please sign in to comment.