Skip to content

Commit 5489fcd

Browse files
authored
Merge pull request #25 from giswqs/develop
Prep for v1.5.0
2 parents b3cbc83 + f0c387e commit 5489fcd

17 files changed

+6213
-1582
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@ This repository is related to the **ArcGIS Python Toolbox for WhiteboxTools**, w
1616
![Note](https://i.imgur.com/Ic8BA7C.png) **Important Note:** This toolbox only supports **ArcGIS Pro and ArcGIS 10.6 or newer**. Don't waste your time trying it on ArcGIS 10.5 or older versions.
1717

1818
* Authors: Dr. John Lindsay (<https://jblindsay.github.io/ghrg/index.html>)
19-
* Contributors: Dr. Qiusheng Wu (<https://wetlands.io> | <https://LidarBlog.com>)
19+
* Contributors: Dr. Qiusheng Wu (<https://wetlands.io> | <https://blog.gishub.com>)
2020
* WhiteboxTools: <https://github.com/jblindsay/whitebox-tools>
2121
* User Manual: <https://jblindsay.github.io/wbt_book>
2222
* WhiteboxTools-ArcGIS: <https://github.com/giswqs/WhiteboxTools-ArcGIS>
2323
* WhiteboxTools-Python: <https://github.com/giswqs/whitebox>
24+
* WhiteboxTools-Jupyter: <https://github.com/giswqs/whiteboxgui>
2425
* WhiteboxTools-R: <https://github.com/giswqs/whiteboxR>
2526
* Free software: [MIT license](https://opensource.org/licenses/MIT)
2627

@@ -72,7 +73,7 @@ Open any tool within the toolbox and start using it. Check out the [WhiteboxTool
7273

7374
## Available Tools
7475

75-
The **[WhiteboxTools](https://github.com/jblindsay/whitebox-tools)** library currently contains **440** tools, which are each grouped based on their main function into one of the following categories: Data Tools, GIS Analysis, Hydrological Analysis, Image Analysis, LiDAR Analysis, Mathematical and Statistical Analysis, Stream Network Analysis, and Terrain Analysis. For a listing of available tools, complete with documentation and usage details, please see the [WhiteboxTools User Manual](https://jblindsay.github.io/wbt_book/available_tools/index.html).
76+
The **[WhiteboxTools](https://github.com/jblindsay/whitebox-tools)** library currently contains **468** tools, which are each grouped based on their main function into one of the following categories: Data Tools, GIS Analysis, Hydrological Analysis, Image Analysis, LiDAR Analysis, Mathematical and Statistical Analysis, Stream Network Analysis, and Terrain Analysis. For a listing of available tools, complete with documentation and usage details, please see the [WhiteboxTools User Manual](https://jblindsay.github.io/wbt_book/available_tools/index.html).
7677

7778
## Supported Data Formats
7879

WBT/LICENSE.txt

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
The MIT License (MIT)
2-
3-
Copyright (c) 2017-2020 John Lindsay
4-
5-
Permission is hereby granted, free of charge, to any person obtaining a copy
6-
of this software and associated documentation files (the "Software"), to deal
7-
in the Software without restriction, including without limitation the rights
8-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9-
copies of the Software, and to permit persons to whom the Software is
10-
furnished to do so, subject to the following conditions:
11-
12-
The above copyright notice and this permission notice shall be included in all
13-
copies or substantial portions of the Software.
14-
15-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2017-2020 John Lindsay
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

WBT/PRE/WhiteboxTools.py

Lines changed: 2714 additions & 695 deletions
Large diffs are not rendered by default.

WBT/PRE/automation.py

Lines changed: 54 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@
1313
import os
1414
import re
1515
import shutil
16-
import sys
1716
import ast
1817
import whitebox
19-
import tarfile
2018
import urllib.request
2119
from zipfile import ZipFile
2220

@@ -71,17 +69,48 @@ def get_tool_params(tool_name):
7169
'''
7270
out_str = wbt.tool_parameters(tool_name)
7371
start_index = out_str.index('[') + 1
74-
end_index = len(out_str.strip()) - 2
72+
if "EXE_NAME" in out_str:
73+
end_index = out_str.rfind("]")
74+
else:
75+
end_index = len(out_str.strip()) - 2
7576
params = out_str[start_index : end_index]
76-
77-
sub_params = params.split('{"name"')
77+
if "EXE_NAME" in out_str:
78+
sub_params = params.split('{"default_value"')
79+
else:
80+
sub_params = params.split('{"name"')
7881
param_list = []
7982

8083
for param in sub_params:
8184
param = param.strip()
8285
if len(param) > 0:
83-
item = '"name"' + param
84-
item = item[ : item.rfind("}")].strip()
86+
if "EXE_NAME" in out_str:
87+
if not param.endswith('},'):
88+
item = '"default_value"' + param[:-1] + ','
89+
else:
90+
item = '"default_value"' + param[:-2] + ','
91+
name_start = item.find('"name"')
92+
name_end = item.find(",", name_start) + 1
93+
name = item[name_start: name_end]
94+
flags_start = item.find('"flags"')
95+
flags_end = item.find('],', flags_start) + 2
96+
flags = item[flags_start: flags_end]
97+
desc_start = item.find('"description"')
98+
desc_end = item.find('",', desc_start) + 2
99+
desc = item[desc_start: desc_end]
100+
ptype_start = item.find('"parameter_type"')
101+
ptype_end = len(item) + 1
102+
ptype = item[ptype_start: ptype_end]
103+
default_start = item.find('"default_value"')
104+
default_end = item.find(',', default_start) + 1
105+
default = item[default_start: default_end]
106+
optional_start = item.find('"optional"')
107+
optional_end = item.find(',', optional_start) + 1
108+
optional = item[optional_start: optional_end]
109+
item = name + flags + desc + ptype + default + optional
110+
else:
111+
item = '"name"' + param
112+
item = item[ : item.rfind("}")].strip()
113+
85114
param_list.append(item)
86115

87116
params_dict = {}
@@ -121,7 +150,11 @@ def get_tool_params(tool_name):
121150
param_dict['description'] = desc
122151

123152
param_type = item[index_parameter_type - 1 : index_default_value - 2].replace('"parameter_type":', '')
124-
param_type = ast.literal_eval(param_type)
153+
try:
154+
param_type = ast.literal_eval(param_type)
155+
except:
156+
pass
157+
125158
param_dict['parameter_type'] = param_type
126159

127160
default_value = item[index_default_value - 1 : index_optional - 2].replace('"default_value":', '')
@@ -396,8 +429,11 @@ def get_data_type(param):
396429

397430
vector_filters = {
398431
'Point': '["Point"]',
432+
'Points': '["Point"]',
399433
'Line': '["Polyline"]',
434+
'Lines': '["Polyline"]',
400435
'Polygon': '["Polygon"]',
436+
'Polygons': '["Polygon"]',
401437
'LineOrPolygon': '["Polyline", "Polygon"]',
402438
'Any': '[]'
403439
}
@@ -464,6 +500,11 @@ def get_github_tag(tool_name, category):
464500
# prefix = "https://github.com/jblindsay/whitebox-tools/blob/master/src/tools"
465501
# url = "{}/{}/{}.rs".format(prefix, category, tool_name)
466502
url = wbt.view_code(tool_name).strip()
503+
# print(tool_name)
504+
# if tool_name == "split_vector_lines":
505+
# print(url)
506+
if "RUST_BACKTRACE" in url:
507+
url = "https://github.com/jblindsay/whitebox-tools/tree/master/whitebox-tools-app/src/tools"
467508
html_tag = "<a href='{}' target='_blank'>GitHub</a>".format(url)
468509
return html_tag
469510

@@ -506,7 +547,7 @@ def get_book_tag(tool_name, category):
506547

507548
if not os.path.exists(wbt_win_zip):
508549
print("Downloading WhiteboxTools binary ...")
509-
url = "https://jblindsay.github.io/ghrg/WhiteboxTools/WhiteboxTools_win_amd64.zip"
550+
url = "https://www.whiteboxgeo.com/WBT_Windows/WhiteboxTools_win_amd64.zip"
510551
urllib.request.urlretrieve(url, wbt_win_zip) # Download WhiteboxTools
511552
else:
512553
print("WhiteboxTools binary already exists.")
@@ -528,6 +569,7 @@ def get_book_tag(tool_name, category):
528569
"# Image Processing Tools #": "Image Processing Tools",
529570
"# LiDAR Tools #": "LiDAR Tools",
530571
"# Math and Stats Tools #": "Math and Stats Tools",
572+
"# Precision Agriculture #": "Precision Agriculture",
531573
"# Stream Network Analysis #": "Stream Network Analysis"
532574
}
533575

@@ -539,6 +581,7 @@ def get_book_tag(tool_name, category):
539581
"Image Processing Tools": "image_analysis",
540582
"LiDAR Tools": "lidar_analysis",
541583
"Math and Stats Tools": "math_stat_analysis",
584+
"Precision Agriculture": "precision_agriculture",
542585
"Stream Network Analysis": "stream_network_analysis"
543586
}
544587

@@ -550,6 +593,7 @@ def get_book_tag(tool_name, category):
550593
"Image Processing Tools": "image_processing_tools",
551594
"LiDAR Tools": "lidar_tools",
552595
"Math and Stats Tools": "mathand_stats_tools",
596+
"Precision Agriculture": "precision_agriculture",
553597
"Stream Network Analysis": "stream_network_analysis"
554598
}
555599

@@ -581,6 +625,7 @@ def get_book_tag(tool_name, category):
581625
tool_labels.append(func_label)
582626
func_desc = lines[index+1].replace('"""', '').strip()
583627

628+
584629
github_tag = get_github_tag(func_title, github_cls[category])
585630
book_tag = get_book_tag(func_name, book_cls[category])
586631
full_desc = "{} View detailed help documentation on {} and source code on {}.".format(func_desc, book_tag, github_tag)

WBT/PRE/file_header.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
tool_labels.append("Artanh")
2626
tool_labels.append("Ascii To Las")
2727
tool_labels.append("Aspect")
28+
tool_labels.append("Assess Route")
2829
tool_labels.append("Atan2")
2930
tool_labels.append("Attribute Correlation")
3031
tool_labels.append("Attribute Correlation Neighbourhood Analysis")
@@ -45,6 +46,7 @@
4546
tool_labels.append("Breach Single Cell Pits")
4647
tool_labels.append("Buffer Raster")
4748
tool_labels.append("Burn Streams At Roads")
49+
tool_labels.append("Canny Edge Detection")
4850
tool_labels.append("Ceil")
4951
tool_labels.append("Centroid")
5052
tool_labels.append("Centroid Vector")
@@ -113,13 +115,15 @@
113115
tool_labels.append("Elevation Above Stream Euclidean")
114116
tool_labels.append("Eliminate Coincident Points")
115117
tool_labels.append("Elongation Ratio")
118+
tool_labels.append("Embankment Mapping")
116119
tool_labels.append("Emboss Filter")
117120
tool_labels.append("Equal To")
118121
tool_labels.append("Erase")
119122
tool_labels.append("Erase Polygon From Lidar")
120123
tool_labels.append("Erase Polygon From Raster")
121124
tool_labels.append("Euclidean Allocation")
122125
tool_labels.append("Euclidean Distance")
126+
tool_labels.append("Evaluate Training Sites")
123127
tool_labels.append("Exp")
124128
tool_labels.append("Exp2")
125129
tool_labels.append("Export Table To Csv")
@@ -182,6 +186,8 @@
182186
tool_labels.append("Image Correlation")
183187
tool_labels.append("Image Correlation Neighbourhood Analysis")
184188
tool_labels.append("Image Regression")
189+
tool_labels.append("Image Segmentation")
190+
tool_labels.append("Image Slider")
185191
tool_labels.append("Image Stack Profile")
186192
tool_labels.append("Impoundment Size Index")
187193
tool_labels.append("In Place Add")
@@ -193,6 +199,7 @@
193199
tool_labels.append("Integer Division")
194200
tool_labels.append("Integral Image")
195201
tool_labels.append("Intersect")
202+
tool_labels.append("Inverse Principal Component Analysis")
196203
tool_labels.append("Is No Data")
197204
tool_labels.append("Isobasins")
198205
tool_labels.append("Jenson Snap Pour Points")
@@ -235,6 +242,8 @@
235242
tool_labels.append("Lidar Rooftop Analysis")
236243
tool_labels.append("Lidar Segmentation")
237244
tool_labels.append("Lidar Segmentation Based Filter")
245+
tool_labels.append("Lidar Sibson Interpolation")
246+
tool_labels.append("Lidar Sort By Time")
238247
tool_labels.append("Lidar Thin")
239248
tool_labels.append("Lidar Thin High Density")
240249
tool_labels.append("Lidar Tile")
@@ -253,6 +262,7 @@
253262
tool_labels.append("Long Profile")
254263
tool_labels.append("Long Profile From Points")
255264
tool_labels.append("Longest Flowpath")
265+
tool_labels.append("Low Points On Headwater Divides")
256266
tool_labels.append("Lowest Position")
257267
tool_labels.append("Majority Filter")
258268
tool_labels.append("Map Off Terrain Objects")
@@ -277,6 +287,7 @@
277287
tool_labels.append("Merge Vectors")
278288
tool_labels.append("Min")
279289
tool_labels.append("Min Absolute Overlay")
290+
tool_labels.append("Min Dist Classification")
280291
tool_labels.append("Min Downslope Elev Change")
281292
tool_labels.append("Min Max Contrast Stretch")
282293
tool_labels.append("Min Overlay")
@@ -313,9 +324,11 @@
313324
tool_labels.append("Num Upslope Neighbours")
314325
tool_labels.append("Olympic Filter")
315326
tool_labels.append("Opening")
327+
tool_labels.append("Openness")
316328
tool_labels.append("Or")
317329
tool_labels.append("Paired Sample T Test")
318330
tool_labels.append("Panchromatic Sharpening")
331+
tool_labels.append("Parallelepiped Classification")
319332
tool_labels.append("Patch Orientation")
320333
tool_labels.append("Pennock Landform Class")
321334
tool_labels.append("Percent Elev Range")
@@ -325,6 +338,7 @@
325338
tool_labels.append("Percentage Contrast Stretch")
326339
tool_labels.append("Percentile Filter")
327340
tool_labels.append("Perimeter Area Ratio")
341+
tool_labels.append("Phi Coefficient")
328342
tool_labels.append("Pick From List")
329343
tool_labels.append("Plan Curvature")
330344
tool_labels.append("Polygon Area")
@@ -360,6 +374,7 @@
360374
tool_labels.append("Reclass")
361375
tool_labels.append("Reclass Equal Interval")
362376
tool_labels.append("Reclass From File")
377+
tool_labels.append("Recreate Pass Lines")
363378
tool_labels.append("Reinitialize Attribute Table")
364379
tool_labels.append("Related Circumscribing Circle")
365380
tool_labels.append("Relative Aspect")
@@ -380,6 +395,7 @@
380395
tool_labels.append("Sediment Transport Index")
381396
tool_labels.append("Select Tiles By Polygon")
382397
tool_labels.append("Set Nodata Value")
398+
tool_labels.append("Shadow Animation")
383399
tool_labels.append("Shape Complexity Index")
384400
tool_labels.append("Shape Complexity Index Raster")
385401
tool_labels.append("Shreve Stream Magnitude")
@@ -391,10 +407,12 @@
391407
tool_labels.append("Slope")
392408
tool_labels.append("Slope Vs Elevation Plot")
393409
tool_labels.append("Smooth Vectors")
410+
tool_labels.append("Smooth Vegetation Residual")
394411
tool_labels.append("Snap Pour Points")
395412
tool_labels.append("Sobel Filter")
396413
tool_labels.append("Spherical Std Dev Of Normals")
397414
tool_labels.append("Split Colour Composite")
415+
tool_labels.append("Split Vector Lines")
398416
tool_labels.append("Split With Lines")
399417
tool_labels.append("Square")
400418
tool_labels.append("Square Root")
@@ -424,6 +442,7 @@
424442
tool_labels.append("To Degrees")
425443
tool_labels.append("To Radians")
426444
tool_labels.append("Tophat Transform")
445+
tool_labels.append("Topographic Position Animation")
427446
tool_labels.append("Topological Stream Order")
428447
tool_labels.append("Total Curvature")
429448
tool_labels.append("Total Filter")
@@ -454,6 +473,8 @@
454473
tool_labels.append("Wilcoxon Signed Rank Test")
455474
tool_labels.append("Write Function Memory Insertion")
456475
tool_labels.append("Xor")
476+
tool_labels.append("Yield Filter")
477+
tool_labels.append("Yield Map")
457478
tool_labels.append("Z Scores")
458479
tool_labels.append("Zlidar To Las")
459480
tool_labels.append("Zonal Statistics")

WBT/UserManual.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
The WhiteboxTools User Manual is now available online at:
2-
3-
https://jblindsay.github.io/wbt_book/index.html
4-
5-
Please see the manual for details on usage and for descriptions of available tools.
1+
The WhiteboxTools User Manual is now available online at:
2+
3+
https://jblindsay.github.io/wbt_book/index.html
4+
5+
Please see the manual for details on usage and for descriptions of available tools.
66
The PDF version of the User Manual is no longer distributed along with the software.
46.5 KB
Loading

0 commit comments

Comments
 (0)