-
Notifications
You must be signed in to change notification settings - Fork 30
/
lidar_analysis.R
2819 lines (2689 loc) · 135 KB
/
lidar_analysis.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#' @title Ascii to las
#'
#' @description Converts one or more ASCII files containing LiDAR points into LAS files.
#'
#' @param inputs Input LiDAR ASCII files (.csv).
#' @param pattern Input field pattern.
#' @param proj Well-known-text string or EPSG code describing projection.
#' @param wd Changes the working directory. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_wd()` for details.
#' @param verbose_mode Sets verbose mode. If verbose mode is `FALSE`, tools will not print output messages. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_verbose()` for details.
#' @param compress_rasters Sets the flag used by 'WhiteboxTools' to determine whether to use compression for output rasters. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_compress_rasters()` for details.
#' @param command_only Return command that would be executed by `system()` rather than running tool. Default: `FALSE`.
#'
#' @keywords LiDARTools
#'
#' @return Returns the tool text outputs.
#' @export
wbt_ascii_to_las <- function(inputs, pattern, proj=NULL, wd=NULL, verbose_mode=NULL, compress_rasters=NULL, command_only=FALSE) {
wbt_init()
args <- ""
args <- paste(args, paste0("--inputs=", wbt_file_path(inputs)))
args <- paste(args, paste0("--pattern=", wbt_file_path(pattern)))
if (!is.null(proj)) {
args <- paste(args, paste0("--proj=", proj))
}
if (!missing(wd)) {
args <- paste(args, paste0("--wd=", wbt_file_path(wd)))
}
if (!missing(compress_rasters)) {
args <- paste(args, paste0("--compress_rasters=", compress_rasters))
}
tool_name <- "ascii_to_las"
wbt_run_tool(tool_name, args, verbose_mode, command_only)
}
#' @title Classify buildings in lidar
#'
#' @description Reclassifies a LiDAR points that lie within vector building footprints.
#'
#' @param input Input LiDAR file.
#' @param buildings Input vector polygons file.
#' @param output Output LiDAR file.
#' @param wd Changes the working directory. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_wd()` for details.
#' @param verbose_mode Sets verbose mode. If verbose mode is `FALSE`, tools will not print output messages. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_verbose()` for details.
#' @param compress_rasters Sets the flag used by 'WhiteboxTools' to determine whether to use compression for output rasters. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_compress_rasters()` for details.
#' @param command_only Return command that would be executed by `system()` rather than running tool. Default: `FALSE`.
#'
#' @keywords LiDARTools
#'
#' @return Returns the tool text outputs.
#' @export
wbt_classify_buildings_in_lidar <- function(input, buildings, output, wd=NULL, verbose_mode=NULL, compress_rasters=NULL, command_only=FALSE) {
wbt_init()
args <- ""
args <- paste(args, paste0("--input=", wbt_file_path(input)))
args <- paste(args, paste0("--buildings=", wbt_file_path(buildings)))
args <- paste(args, paste0("--output=", wbt_file_path(output)))
if (!missing(wd)) {
args <- paste(args, paste0("--wd=", wbt_file_path(wd)))
}
if (!missing(compress_rasters)) {
args <- paste(args, paste0("--compress_rasters=", compress_rasters))
}
tool_name <- "classify_buildings_in_lidar"
wbt_run_tool(tool_name, args, verbose_mode, command_only)
}
#' @title Classify lidar
#'
#' @description Classify points within a LiDAR point cloud based on point properties.
#'
#' @param input Name of the input LiDAR points.
#' @param output Name of the output LiDAR points.
#' @param radius Search distance used in neighbourhood search (metres).
#' @param grd_threshold Ground threshold (metres).
#' @param oto_threshold Off-terrain object threshold (metres).
#' @param planarity_threshold Planarity threshold (0-1).
#' @param linearity_threshold Linearity threshold (0-1).
#' @param iterations Number of iterations.
#' @param facade_threshold Facade threshold (metres).
#' @param wd Changes the working directory. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_wd()` for details.
#' @param verbose_mode Sets verbose mode. If verbose mode is `FALSE`, tools will not print output messages. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_verbose()` for details.
#' @param compress_rasters Sets the flag used by 'WhiteboxTools' to determine whether to use compression for output rasters. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_compress_rasters()` for details.
#' @param command_only Return command that would be executed by `system()` rather than running tool. Default: `FALSE`.
#'
#' @keywords LiDARTools
#'
#' @return Returns the tool text outputs.
#' @export
wbt_classify_lidar <- function(input, output=NULL, radius=1.5, grd_threshold=0.1, oto_threshold=2.0, planarity_threshold=0.85, linearity_threshold=0.70, iterations=30, facade_threshold=0.5, wd=NULL, verbose_mode=NULL, compress_rasters=NULL, command_only=FALSE) {
wbt_init()
args <- ""
args <- paste(args, paste0("--input=", wbt_file_path(input)))
if (!is.null(output)) {
args <- paste(args, paste0("--output=", wbt_file_path(output)))
}
if (!is.null(radius)) {
args <- paste(args, paste0("--radius=", radius))
}
if (!is.null(grd_threshold)) {
args <- paste(args, paste0("--grd_threshold=", grd_threshold))
}
if (!is.null(oto_threshold)) {
args <- paste(args, paste0("--oto_threshold=", oto_threshold))
}
if (!is.null(planarity_threshold)) {
args <- paste(args, paste0("--planarity_threshold=", planarity_threshold))
}
if (!is.null(linearity_threshold)) {
args <- paste(args, paste0("--linearity_threshold=", linearity_threshold))
}
if (!is.null(iterations)) {
args <- paste(args, paste0("--iterations=", iterations))
}
if (!is.null(facade_threshold)) {
args <- paste(args, paste0("--facade_threshold=", facade_threshold))
}
if (!missing(wd)) {
args <- paste(args, paste0("--wd=", wbt_file_path(wd)))
}
if (!missing(compress_rasters)) {
args <- paste(args, paste0("--compress_rasters=", compress_rasters))
}
tool_name <- "classify_lidar"
wbt_run_tool(tool_name, args, verbose_mode, command_only)
}
#' @title Classify overlap points
#'
#' @description Classifies or filters LAS points in regions of overlapping flight lines.
#'
#' @param input Input LiDAR file.
#' @param output Output LiDAR file.
#' @param resolution The size of the square area used to evaluate nearby points in the LiDAR data.
#' @param criterion Criterion used to identify overlapping points; options are 'max scan angle', 'not min point source ID', 'not min time', 'multiple point source IDs'.
#' @param filter Filter out points from overlapping flightlines? If false, overlaps will simply be classified.
#' @param wd Changes the working directory. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_wd()` for details.
#' @param verbose_mode Sets verbose mode. If verbose mode is `FALSE`, tools will not print output messages. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_verbose()` for details.
#' @param compress_rasters Sets the flag used by 'WhiteboxTools' to determine whether to use compression for output rasters. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_compress_rasters()` for details.
#' @param command_only Return command that would be executed by `system()` rather than running tool. Default: `FALSE`.
#'
#' @keywords LiDARTools
#'
#' @return Returns the tool text outputs.
#' @export
wbt_classify_overlap_points <- function(input, output, resolution=2.0, criterion="max scan angle", filter=FALSE, wd=NULL, verbose_mode=NULL, compress_rasters=NULL, command_only=FALSE) {
wbt_init()
args <- ""
args <- paste(args, paste0("--input=", wbt_file_path(input)))
args <- paste(args, paste0("--output=", wbt_file_path(output)))
if (!is.null(resolution)) {
args <- paste(args, paste0("--resolution=", resolution))
}
if (!is.null(criterion)) {
args <- paste(args, paste0("--criterion=", criterion))
}
if (filter) {
args <- paste(args, "--filter")
}
if (!missing(wd)) {
args <- paste(args, paste0("--wd=", wbt_file_path(wd)))
}
if (!missing(compress_rasters)) {
args <- paste(args, paste0("--compress_rasters=", compress_rasters))
}
tool_name <- "classify_overlap_points"
wbt_run_tool(tool_name, args, verbose_mode, command_only)
}
#' @title Clip lidar to polygon
#'
#' @description Clips a LiDAR point cloud to a vector polygon or polygons.
#'
#' @param input Input LiDAR file.
#' @param polygons Input vector polygons file.
#' @param output Output LiDAR file.
#' @param wd Changes the working directory. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_wd()` for details.
#' @param verbose_mode Sets verbose mode. If verbose mode is `FALSE`, tools will not print output messages. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_verbose()` for details.
#' @param compress_rasters Sets the flag used by 'WhiteboxTools' to determine whether to use compression for output rasters. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_compress_rasters()` for details.
#' @param command_only Return command that would be executed by `system()` rather than running tool. Default: `FALSE`.
#'
#' @keywords LiDARTools
#'
#' @return Returns the tool text outputs.
#' @export
wbt_clip_lidar_to_polygon <- function(input, polygons, output, wd=NULL, verbose_mode=NULL, compress_rasters=NULL, command_only=FALSE) {
wbt_init()
args <- ""
args <- paste(args, paste0("--input=", wbt_file_path(input)))
args <- paste(args, paste0("--polygons=", wbt_file_path(polygons)))
args <- paste(args, paste0("--output=", wbt_file_path(output)))
if (!missing(wd)) {
args <- paste(args, paste0("--wd=", wbt_file_path(wd)))
}
if (!missing(compress_rasters)) {
args <- paste(args, paste0("--compress_rasters=", compress_rasters))
}
tool_name <- "clip_lidar_to_polygon"
wbt_run_tool(tool_name, args, verbose_mode, command_only)
}
#' @title Colourize based on class
#'
#' @description Sets the RGB values of a LiDAR point cloud based on the point classification values.
#'
#' @param input Name of the input LiDAR points.
#' @param output Name of the output LiDAR points.
#' @param intensity_blending Intensity blending amount (0-100 percent).
#' @param clr_str Colour values, e.g. 2: (184, 167, 108); 5: #9ab86c.
#' @param use_unique_clrs_for_buildings Use unique colours for each building?.
#' @param radius Search distance used in neighbourhood search.
#' @param wd Changes the working directory. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_wd()` for details.
#' @param verbose_mode Sets verbose mode. If verbose mode is `FALSE`, tools will not print output messages. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_verbose()` for details.
#' @param compress_rasters Sets the flag used by 'WhiteboxTools' to determine whether to use compression for output rasters. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_compress_rasters()` for details.
#' @param command_only Return command that would be executed by `system()` rather than running tool. Default: `FALSE`.
#'
#' @keywords LiDARTools
#'
#' @return Returns the tool text outputs.
#' @export
wbt_colourize_based_on_class <- function(input, output=NULL, intensity_blending=50.0, clr_str="", use_unique_clrs_for_buildings=FALSE, radius="", wd=NULL, verbose_mode=NULL, compress_rasters=NULL, command_only=FALSE) {
wbt_init()
args <- ""
args <- paste(args, paste0("--input=", wbt_file_path(input)))
if (!is.null(output)) {
args <- paste(args, paste0("--output=", wbt_file_path(output)))
}
if (!is.null(intensity_blending)) {
args <- paste(args, paste0("--intensity_blending=", intensity_blending))
}
if (!is.null(clr_str)) {
args <- paste(args, paste0("--clr_str=", clr_str))
}
if (use_unique_clrs_for_buildings) {
args <- paste(args, "--use_unique_clrs_for_buildings")
}
if (!is.null(radius)) {
args <- paste(args, paste0("--radius=", radius))
}
if (!missing(wd)) {
args <- paste(args, paste0("--wd=", wbt_file_path(wd)))
}
if (!missing(compress_rasters)) {
args <- paste(args, paste0("--compress_rasters=", compress_rasters))
}
tool_name <- "colourize_based_on_class"
wbt_run_tool(tool_name, args, verbose_mode, command_only)
}
#' @title Colourize based on point returns
#'
#' @description Sets the RGB values of a LiDAR point cloud based on the point returns.
#'
#' @param input Name of the input LiDAR points.
#' @param output Name of the output LiDAR points.
#' @param intensity_blending Intensity blending amount (0-100 percent).
#' @param only Only return colour, e.g. (230,214,170), #e6d6aa, or 0xe6d6aa.
#' @param first First return colour, e.g. (230,214,170), #e6d6aa, or 0xe6d6aa.
#' @param intermediate Intermediate return colour, e.g. (230,214,170), #e6d6aa, or 0xe6d6aa.
#' @param last Last return colour, e.g. (230,214,170), #e6d6aa, or 0xe6d6aa.
#' @param wd Changes the working directory. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_wd()` for details.
#' @param verbose_mode Sets verbose mode. If verbose mode is `FALSE`, tools will not print output messages. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_verbose()` for details.
#' @param compress_rasters Sets the flag used by 'WhiteboxTools' to determine whether to use compression for output rasters. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_compress_rasters()` for details.
#' @param command_only Return command that would be executed by `system()` rather than running tool. Default: `FALSE`.
#'
#' @keywords LiDARTools
#'
#' @return Returns the tool text outputs.
#' @export
wbt_colourize_based_on_point_returns <- function(input, output=NULL, intensity_blending=50.0, only="(230,214,170)", first="(0,140,0)", intermediate="(255,0,255)", last="(0,0,255)", wd=NULL, verbose_mode=NULL, compress_rasters=NULL, command_only=FALSE) {
wbt_init()
args <- ""
args <- paste(args, paste0("--input=", wbt_file_path(input)))
if (!is.null(output)) {
args <- paste(args, paste0("--output=", wbt_file_path(output)))
}
if (!is.null(intensity_blending)) {
args <- paste(args, paste0("--intensity_blending=", intensity_blending))
}
if (!is.null(only)) {
args <- paste(args, paste0("--only=", only))
}
args <- paste(args, paste0("--214=", wbt_file_path(214)))
if (!is.null(first)) {
args <- paste(args, paste0("--first=", first))
}
args <- paste(args, paste0("--140=", wbt_file_path(140)))
if (!is.null(intermediate)) {
args <- paste(args, paste0("--intermediate=", intermediate))
}
args <- paste(args, paste0("--0=", wbt_file_path(0)))
if (!is.null(last)) {
args <- paste(args, paste0("--last=", last))
}
args <- paste(args, paste0("--0=", wbt_file_path(0)))
if (!missing(wd)) {
args <- paste(args, paste0("--wd=", wbt_file_path(wd)))
}
if (!missing(compress_rasters)) {
args <- paste(args, paste0("--compress_rasters=", compress_rasters))
}
tool_name <- "colourize_based_on_point_returns"
wbt_run_tool(tool_name, args, verbose_mode, command_only)
}
#' @title Erase polygon from lidar
#'
#' @description Erases (cuts out) a vector polygon or polygons from a LiDAR point cloud.
#'
#' @param input Input LiDAR file.
#' @param polygons Input vector polygons file.
#' @param output Output LiDAR file.
#' @param wd Changes the working directory. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_wd()` for details.
#' @param verbose_mode Sets verbose mode. If verbose mode is `FALSE`, tools will not print output messages. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_verbose()` for details.
#' @param compress_rasters Sets the flag used by 'WhiteboxTools' to determine whether to use compression for output rasters. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_compress_rasters()` for details.
#' @param command_only Return command that would be executed by `system()` rather than running tool. Default: `FALSE`.
#'
#' @keywords LiDARTools
#'
#' @return Returns the tool text outputs.
#' @export
wbt_erase_polygon_from_lidar <- function(input, polygons, output, wd=NULL, verbose_mode=NULL, compress_rasters=NULL, command_only=FALSE) {
wbt_init()
args <- ""
args <- paste(args, paste0("--input=", wbt_file_path(input)))
args <- paste(args, paste0("--polygons=", wbt_file_path(polygons)))
args <- paste(args, paste0("--output=", wbt_file_path(output)))
if (!missing(wd)) {
args <- paste(args, paste0("--wd=", wbt_file_path(wd)))
}
if (!missing(compress_rasters)) {
args <- paste(args, paste0("--compress_rasters=", compress_rasters))
}
tool_name <- "erase_polygon_from_lidar"
wbt_run_tool(tool_name, args, verbose_mode, command_only)
}
#' @title Filter lidar
#'
#' @description Filters points within a LiDAR point cloud based on point properties.
#'
#' @param input Name of the input LiDAR points.
#' @param output Name of the output LiDAR points.
#' @param statement Filter statement e.g. x < 5000.0 && y > 100.0 && is_late && !is_noise. This statement must be a valid Rust statement.
#' @param wd Changes the working directory. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_wd()` for details.
#' @param verbose_mode Sets verbose mode. If verbose mode is `FALSE`, tools will not print output messages. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_verbose()` for details.
#' @param compress_rasters Sets the flag used by 'WhiteboxTools' to determine whether to use compression for output rasters. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_compress_rasters()` for details.
#' @param command_only Return command that would be executed by `system()` rather than running tool. Default: `FALSE`.
#'
#' @keywords LiDARTools
#'
#' @return Returns the tool text outputs.
#' @export
wbt_filter_lidar <- function(input, output=NULL, statement="", wd=NULL, verbose_mode=NULL, compress_rasters=NULL, command_only=FALSE) {
wbt_init()
args <- ""
args <- paste(args, paste0("--input=", wbt_file_path(input)))
if (!is.null(output)) {
args <- paste(args, paste0("--output=", wbt_file_path(output)))
}
if (!is.null(statement)) {
args <- paste(args, paste0("--statement=", statement))
}
if (!missing(wd)) {
args <- paste(args, paste0("--wd=", wbt_file_path(wd)))
}
if (!missing(compress_rasters)) {
args <- paste(args, paste0("--compress_rasters=", compress_rasters))
}
tool_name <- "filter_lidar"
wbt_run_tool(tool_name, args, verbose_mode, command_only)
}
#' @title Filter lidar classes
#'
#' @description Removes points in a LAS file with certain specified class values.
#'
#' @param input Input LiDAR file.
#' @param output Output LiDAR file.
#' @param exclude_cls Optional exclude classes from interpolation; Valid class values range from 0 to 18, based on LAS specifications. Example, --exclude_cls='3,4,5,6,7,18'.
#' @param wd Changes the working directory. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_wd()` for details.
#' @param verbose_mode Sets verbose mode. If verbose mode is `FALSE`, tools will not print output messages. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_verbose()` for details.
#' @param compress_rasters Sets the flag used by 'WhiteboxTools' to determine whether to use compression for output rasters. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_compress_rasters()` for details.
#' @param command_only Return command that would be executed by `system()` rather than running tool. Default: `FALSE`.
#'
#' @keywords LiDARTools
#'
#' @return Returns the tool text outputs.
#' @export
wbt_filter_lidar_classes <- function(input, output, exclude_cls=NULL, wd=NULL, verbose_mode=NULL, compress_rasters=NULL, command_only=FALSE) {
wbt_init()
args <- ""
args <- paste(args, paste0("--input=", wbt_file_path(input)))
args <- paste(args, paste0("--output=", wbt_file_path(output)))
if (!is.null(exclude_cls)) {
args <- paste(args, paste0("--exclude_cls=", exclude_cls))
}
if (!missing(wd)) {
args <- paste(args, paste0("--wd=", wbt_file_path(wd)))
}
if (!missing(compress_rasters)) {
args <- paste(args, paste0("--compress_rasters=", compress_rasters))
}
tool_name <- "filter_lidar_classes"
wbt_run_tool(tool_name, args, verbose_mode, command_only)
}
#' @title Filter lidar scan angles
#'
#' @description Removes points in a LAS file with scan angles greater than a threshold.
#'
#' @param input Input LiDAR file.
#' @param output Output LiDAR file.
#' @param threshold Scan angle threshold.
#' @param wd Changes the working directory. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_wd()` for details.
#' @param verbose_mode Sets verbose mode. If verbose mode is `FALSE`, tools will not print output messages. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_verbose()` for details.
#' @param compress_rasters Sets the flag used by 'WhiteboxTools' to determine whether to use compression for output rasters. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_compress_rasters()` for details.
#' @param command_only Return command that would be executed by `system()` rather than running tool. Default: `FALSE`.
#'
#' @keywords LiDARTools
#'
#' @return Returns the tool text outputs.
#' @export
wbt_filter_lidar_scan_angles <- function(input, output, threshold, wd=NULL, verbose_mode=NULL, compress_rasters=NULL, command_only=FALSE) {
wbt_init()
args <- ""
args <- paste(args, paste0("--input=", wbt_file_path(input)))
args <- paste(args, paste0("--output=", wbt_file_path(output)))
args <- paste(args, paste0("--threshold=", wbt_file_path(threshold)))
if (!missing(wd)) {
args <- paste(args, paste0("--wd=", wbt_file_path(wd)))
}
if (!missing(compress_rasters)) {
args <- paste(args, paste0("--compress_rasters=", compress_rasters))
}
tool_name <- "filter_lidar_scan_angles"
wbt_run_tool(tool_name, args, verbose_mode, command_only)
}
#' @title Find flightline edge points
#'
#' @description Identifies points along a flightline's edge in a LAS file.
#'
#' @param input Input LiDAR file.
#' @param output Output file.
#' @param wd Changes the working directory. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_wd()` for details.
#' @param verbose_mode Sets verbose mode. If verbose mode is `FALSE`, tools will not print output messages. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_verbose()` for details.
#' @param compress_rasters Sets the flag used by 'WhiteboxTools' to determine whether to use compression for output rasters. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_compress_rasters()` for details.
#' @param command_only Return command that would be executed by `system()` rather than running tool. Default: `FALSE`.
#'
#' @keywords LiDARTools
#'
#' @return Returns the tool text outputs.
#' @export
wbt_find_flightline_edge_points <- function(input, output, wd=NULL, verbose_mode=NULL, compress_rasters=NULL, command_only=FALSE) {
wbt_init()
args <- ""
args <- paste(args, paste0("--input=", wbt_file_path(input)))
args <- paste(args, paste0("--output=", wbt_file_path(output)))
if (!missing(wd)) {
args <- paste(args, paste0("--wd=", wbt_file_path(wd)))
}
if (!missing(compress_rasters)) {
args <- paste(args, paste0("--compress_rasters=", compress_rasters))
}
tool_name <- "find_flightline_edge_points"
wbt_run_tool(tool_name, args, verbose_mode, command_only)
}
#' @title Flightline overlap
#'
#' @description Reads a LiDAR (LAS) point file and outputs a raster containing the number of overlapping flight-lines in each grid cell.
#'
#' @param input Input LiDAR file.
#' @param output Output file.
#' @param resolution Output raster's grid resolution.
#' @param wd Changes the working directory. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_wd()` for details.
#' @param verbose_mode Sets verbose mode. If verbose mode is `FALSE`, tools will not print output messages. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_verbose()` for details.
#' @param compress_rasters Sets the flag used by 'WhiteboxTools' to determine whether to use compression for output rasters. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_compress_rasters()` for details.
#' @param command_only Return command that would be executed by `system()` rather than running tool. Default: `FALSE`.
#'
#' @keywords LiDARTools
#'
#' @return Returns the tool text outputs.
#' @export
wbt_flightline_overlap <- function(input, output=NULL, resolution=1.0, wd=NULL, verbose_mode=NULL, compress_rasters=NULL, command_only=FALSE) {
wbt_init()
args <- ""
args <- paste(args, paste0("--input=", wbt_file_path(input)))
if (!is.null(output)) {
args <- paste(args, paste0("--output=", wbt_file_path(output)))
}
if (!is.null(resolution)) {
args <- paste(args, paste0("--resolution=", resolution))
}
if (!missing(wd)) {
args <- paste(args, paste0("--wd=", wbt_file_path(wd)))
}
if (!missing(compress_rasters)) {
args <- paste(args, paste0("--compress_rasters=", compress_rasters))
}
tool_name <- "flightline_overlap"
wbt_run_tool(tool_name, args, verbose_mode, command_only)
}
#' @title Height above ground
#'
#' @description Normalizes a LiDAR point cloud, providing the height above the nearest ground-classified point.
#'
#' @param input Input LiDAR file (including extension).
#' @param output Output lidar file (including extension).
#' @param wd Changes the working directory. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_wd()` for details.
#' @param verbose_mode Sets verbose mode. If verbose mode is `FALSE`, tools will not print output messages. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_verbose()` for details.
#' @param compress_rasters Sets the flag used by 'WhiteboxTools' to determine whether to use compression for output rasters. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_compress_rasters()` for details.
#' @param command_only Return command that would be executed by `system()` rather than running tool. Default: `FALSE`.
#'
#' @keywords LiDARTools
#'
#' @return Returns the tool text outputs.
#' @export
wbt_height_above_ground <- function(input, output=NULL, wd=NULL, verbose_mode=NULL, compress_rasters=NULL, command_only=FALSE) {
wbt_init()
args <- ""
args <- paste(args, paste0("--input=", wbt_file_path(input)))
if (!is.null(output)) {
args <- paste(args, paste0("--output=", wbt_file_path(output)))
}
if (!missing(wd)) {
args <- paste(args, paste0("--wd=", wbt_file_path(wd)))
}
if (!missing(compress_rasters)) {
args <- paste(args, paste0("--compress_rasters=", compress_rasters))
}
tool_name <- "height_above_ground"
wbt_run_tool(tool_name, args, verbose_mode, command_only)
}
#' @title Individual tree detection
#'
#' @description Identifies points in a LiDAR point cloud that are associated with the tops of individual trees.
#'
#' @param input Name of the input LiDAR file.
#' @param output Name of the output vector points file.
#' @param min_search_radius Minimum search radius (m).
#' @param min_height Minimum height (m).
#' @param max_search_radius Maximum search radius (m).
#' @param max_height Maximum height (m).
#' @param only_use_veg Only use veg. class points?.
#' @param wd Changes the working directory. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_wd()` for details.
#' @param verbose_mode Sets verbose mode. If verbose mode is `FALSE`, tools will not print output messages. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_verbose()` for details.
#' @param compress_rasters Sets the flag used by 'WhiteboxTools' to determine whether to use compression for output rasters. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_compress_rasters()` for details.
#' @param command_only Return command that would be executed by `system()` rather than running tool. Default: `FALSE`.
#'
#' @keywords LiDARTools
#'
#' @return Returns the tool text outputs.
#' @export
wbt_individual_tree_detection <- function(input, output=NULL, min_search_radius=1.0, min_height=0.0, max_search_radius="", max_height="", only_use_veg=FALSE, wd=NULL, verbose_mode=NULL, compress_rasters=NULL, command_only=FALSE) {
wbt_init()
args <- ""
args <- paste(args, paste0("--input=", wbt_file_path(input)))
if (!is.null(output)) {
args <- paste(args, paste0("--output=", wbt_file_path(output)))
}
if (!is.null(min_search_radius)) {
args <- paste(args, paste0("--min_search_radius=", min_search_radius))
}
if (!is.null(min_height)) {
args <- paste(args, paste0("--min_height=", min_height))
}
if (!is.null(max_search_radius)) {
args <- paste(args, paste0("--max_search_radius=", max_search_radius))
}
if (!is.null(max_height)) {
args <- paste(args, paste0("--max_height=", max_height))
}
if (only_use_veg) {
args <- paste(args, "--only_use_veg")
}
if (!missing(wd)) {
args <- paste(args, paste0("--wd=", wbt_file_path(wd)))
}
if (!missing(compress_rasters)) {
args <- paste(args, paste0("--compress_rasters=", compress_rasters))
}
tool_name <- "individual_tree_detection"
wbt_run_tool(tool_name, args, verbose_mode, command_only)
}
#' @title Las to ascii
#'
#' @description Converts one or more LAS files into ASCII text files.
#'
#' @param inputs Input LiDAR files.
#' @param wd Changes the working directory. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_wd()` for details.
#' @param verbose_mode Sets verbose mode. If verbose mode is `FALSE`, tools will not print output messages. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_verbose()` for details.
#' @param compress_rasters Sets the flag used by 'WhiteboxTools' to determine whether to use compression for output rasters. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_compress_rasters()` for details.
#' @param command_only Return command that would be executed by `system()` rather than running tool. Default: `FALSE`.
#'
#' @keywords LiDARTools
#'
#' @return Returns the tool text outputs.
#' @export
wbt_las_to_ascii <- function(inputs, wd=NULL, verbose_mode=NULL, compress_rasters=NULL, command_only=FALSE) {
wbt_init()
args <- ""
args <- paste(args, paste0("--inputs=", wbt_file_path(inputs)))
if (!missing(wd)) {
args <- paste(args, paste0("--wd=", wbt_file_path(wd)))
}
if (!missing(compress_rasters)) {
args <- paste(args, paste0("--compress_rasters=", compress_rasters))
}
tool_name <- "las_to_ascii"
wbt_run_tool(tool_name, args, verbose_mode, command_only)
}
#' @title Las to laz
#'
#' @description This tool converts one or more LAS files into the LAZ format.
#'
#' @param input Name of the input LAS files (leave blank to use all LAS files in WorkingDirectory.
#' @param output Output LAZ file (including extension).
#' @param wd Changes the working directory. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_wd()` for details.
#' @param verbose_mode Sets verbose mode. If verbose mode is `FALSE`, tools will not print output messages. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_verbose()` for details.
#' @param compress_rasters Sets the flag used by 'WhiteboxTools' to determine whether to use compression for output rasters. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_compress_rasters()` for details.
#' @param command_only Return command that would be executed by `system()` rather than running tool. Default: `FALSE`.
#'
#' @keywords LiDARTools
#'
#' @return Returns the tool text outputs.
#' @export
wbt_las_to_laz <- function(input, output=NULL, wd=NULL, verbose_mode=NULL, compress_rasters=NULL, command_only=FALSE) {
wbt_init()
args <- ""
args <- paste(args, paste0("--input=", wbt_file_path(input)))
if (!is.null(output)) {
args <- paste(args, paste0("--output=", wbt_file_path(output)))
}
if (!missing(wd)) {
args <- paste(args, paste0("--wd=", wbt_file_path(wd)))
}
if (!missing(compress_rasters)) {
args <- paste(args, paste0("--compress_rasters=", compress_rasters))
}
tool_name <- "las_to_laz"
wbt_run_tool(tool_name, args, verbose_mode, command_only)
}
#' @title Las to multipoint shapefile
#'
#' @description Converts one or more LAS files into MultipointZ vector Shapefiles. When the input parameter is not specified, the tool grids all LAS files contained within the working directory.
#'
#' @param input Input LiDAR file.
#' @param wd Changes the working directory. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_wd()` for details.
#' @param verbose_mode Sets verbose mode. If verbose mode is `FALSE`, tools will not print output messages. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_verbose()` for details.
#' @param compress_rasters Sets the flag used by 'WhiteboxTools' to determine whether to use compression for output rasters. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_compress_rasters()` for details.
#' @param command_only Return command that would be executed by `system()` rather than running tool. Default: `FALSE`.
#'
#' @keywords LiDARTools
#'
#' @return Returns the tool text outputs.
#' @export
wbt_las_to_multipoint_shapefile <- function(input, wd=NULL, verbose_mode=NULL, compress_rasters=NULL, command_only=FALSE) {
wbt_init()
args <- ""
args <- paste(args, paste0("--input=", wbt_file_path(input)))
if (!missing(wd)) {
args <- paste(args, paste0("--wd=", wbt_file_path(wd)))
}
if (!missing(compress_rasters)) {
args <- paste(args, paste0("--compress_rasters=", compress_rasters))
}
tool_name <- "las_to_multipoint_shapefile"
wbt_run_tool(tool_name, args, verbose_mode, command_only)
}
#' @title Las to shapefile
#'
#' @description Converts one or more LAS files into a vector Shapefile of POINT ShapeType.
#'
#' @param input Input LiDAR file.
#' @param wd Changes the working directory. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_wd()` for details.
#' @param verbose_mode Sets verbose mode. If verbose mode is `FALSE`, tools will not print output messages. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_verbose()` for details.
#' @param compress_rasters Sets the flag used by 'WhiteboxTools' to determine whether to use compression for output rasters. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_compress_rasters()` for details.
#' @param command_only Return command that would be executed by `system()` rather than running tool. Default: `FALSE`.
#'
#' @keywords LiDARTools
#'
#' @return Returns the tool text outputs.
#' @export
wbt_las_to_shapefile <- function(input, wd=NULL, verbose_mode=NULL, compress_rasters=NULL, command_only=FALSE) {
wbt_init()
args <- ""
args <- paste(args, paste0("--input=", wbt_file_path(input)))
if (!missing(wd)) {
args <- paste(args, paste0("--wd=", wbt_file_path(wd)))
}
if (!missing(compress_rasters)) {
args <- paste(args, paste0("--compress_rasters=", compress_rasters))
}
tool_name <- "las_to_shapefile"
wbt_run_tool(tool_name, args, verbose_mode, command_only)
}
#' @title Las to zlidar
#'
#' @description Converts one or more LAS files into the zlidar compressed LiDAR data format.
#'
#' @param inputs Input LAS files.
#' @param outdir Output directory into which zlidar files are created. If unspecified, it is assumed to be the same as the inputs.
#' @param compress Compression method, including 'brotli' and 'deflate'.
#' @param level Compression level (1-9).
#' @param wd Changes the working directory. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_wd()` for details.
#' @param verbose_mode Sets verbose mode. If verbose mode is `FALSE`, tools will not print output messages. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_verbose()` for details.
#' @param compress_rasters Sets the flag used by 'WhiteboxTools' to determine whether to use compression for output rasters. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_compress_rasters()` for details.
#' @param command_only Return command that would be executed by `system()` rather than running tool. Default: `FALSE`.
#'
#' @keywords LiDARTools
#'
#' @return Returns the tool text outputs.
#' @export
wbt_las_to_zlidar <- function(inputs=NULL, outdir=NULL, compress="brotli", level=5, wd=NULL, verbose_mode=NULL, compress_rasters=NULL, command_only=FALSE) {
wbt_init()
args <- ""
if (!is.null(inputs)) {
args <- paste(args, paste0("--inputs=", wbt_file_path(inputs)))
}
if (!is.null(outdir)) {
args <- paste(args, paste0("--outdir=", outdir))
}
if (!is.null(compress)) {
args <- paste(args, paste0("--compress=", compress))
}
if (!is.null(level)) {
args <- paste(args, paste0("--level=", level))
}
if (!missing(wd)) {
args <- paste(args, paste0("--wd=", wbt_file_path(wd)))
}
if (!missing(compress_rasters)) {
args <- paste(args, paste0("--compress_rasters=", compress_rasters))
}
tool_name <- "las_to_zlidar"
wbt_run_tool(tool_name, args, verbose_mode, command_only)
}
#' @title Laz to las
#'
#' @description This tool converts one or more LAZ files into the LAS format.
#'
#' @param input Name of the input LAZ files (leave blank to use all LAZ files in WorkingDirectory.
#' @param output Output LAS file (including extension).
#' @param wd Changes the working directory. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_wd()` for details.
#' @param verbose_mode Sets verbose mode. If verbose mode is `FALSE`, tools will not print output messages. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_verbose()` for details.
#' @param compress_rasters Sets the flag used by 'WhiteboxTools' to determine whether to use compression for output rasters. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_compress_rasters()` for details.
#' @param command_only Return command that would be executed by `system()` rather than running tool. Default: `FALSE`.
#'
#' @keywords LiDARTools
#'
#' @return Returns the tool text outputs.
#' @export
wbt_laz_to_las <- function(input, output=NULL, wd=NULL, verbose_mode=NULL, compress_rasters=NULL, command_only=FALSE) {
wbt_init()
args <- ""
args <- paste(args, paste0("--input=", wbt_file_path(input)))
if (!is.null(output)) {
args <- paste(args, paste0("--output=", wbt_file_path(output)))
}
if (!missing(wd)) {
args <- paste(args, paste0("--wd=", wbt_file_path(wd)))
}
if (!missing(compress_rasters)) {
args <- paste(args, paste0("--compress_rasters=", compress_rasters))
}
tool_name <- "laz_to_las"
wbt_run_tool(tool_name, args, verbose_mode, command_only)
}
#' @title Lidar block maximum
#'
#' @description Creates a block-maximum raster from an input LAS file. When the input/output parameters are not specified, the tool grids all LAS files contained within the working directory.
#'
#' @param input Input LiDAR file.
#' @param output Output file.
#' @param resolution Output raster's grid resolution.
#' @param wd Changes the working directory. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_wd()` for details.
#' @param verbose_mode Sets verbose mode. If verbose mode is `FALSE`, tools will not print output messages. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_verbose()` for details.
#' @param compress_rasters Sets the flag used by 'WhiteboxTools' to determine whether to use compression for output rasters. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_compress_rasters()` for details.
#' @param command_only Return command that would be executed by `system()` rather than running tool. Default: `FALSE`.
#'
#' @keywords LiDARTools
#'
#' @return Returns the tool text outputs.
#' @export
wbt_lidar_block_maximum <- function(input, output=NULL, resolution=1.0, wd=NULL, verbose_mode=NULL, compress_rasters=NULL, command_only=FALSE) {
wbt_init()
args <- ""
args <- paste(args, paste0("--input=", wbt_file_path(input)))
if (!is.null(output)) {
args <- paste(args, paste0("--output=", wbt_file_path(output)))
}
if (!is.null(resolution)) {
args <- paste(args, paste0("--resolution=", resolution))
}
if (!missing(wd)) {
args <- paste(args, paste0("--wd=", wbt_file_path(wd)))
}
if (!missing(compress_rasters)) {
args <- paste(args, paste0("--compress_rasters=", compress_rasters))
}
tool_name <- "lidar_block_maximum"
wbt_run_tool(tool_name, args, verbose_mode, command_only)
}
#' @title Lidar block minimum
#'
#' @description Creates a block-minimum raster from an input LAS file. When the input/output parameters are not specified, the tool grids all LAS files contained within the working directory.
#'
#' @param input Input LiDAR file.
#' @param output Output file.
#' @param resolution Output raster's grid resolution.
#' @param wd Changes the working directory. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_wd()` for details.
#' @param verbose_mode Sets verbose mode. If verbose mode is `FALSE`, tools will not print output messages. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_verbose()` for details.
#' @param compress_rasters Sets the flag used by 'WhiteboxTools' to determine whether to use compression for output rasters. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_compress_rasters()` for details.
#' @param command_only Return command that would be executed by `system()` rather than running tool. Default: `FALSE`.
#'
#' @keywords LiDARTools
#'
#' @return Returns the tool text outputs.
#' @export
wbt_lidar_block_minimum <- function(input, output=NULL, resolution=1.0, wd=NULL, verbose_mode=NULL, compress_rasters=NULL, command_only=FALSE) {
wbt_init()
args <- ""
args <- paste(args, paste0("--input=", wbt_file_path(input)))
if (!is.null(output)) {
args <- paste(args, paste0("--output=", wbt_file_path(output)))
}
if (!is.null(resolution)) {
args <- paste(args, paste0("--resolution=", resolution))
}
if (!missing(wd)) {
args <- paste(args, paste0("--wd=", wbt_file_path(wd)))
}
if (!missing(compress_rasters)) {
args <- paste(args, paste0("--compress_rasters=", compress_rasters))
}
tool_name <- "lidar_block_minimum"
wbt_run_tool(tool_name, args, verbose_mode, command_only)
}
#' @title Lidar classify subset
#'
#' @description Classifies the values in one LiDAR point cloud that correspond with points in a subset cloud.
#'
#' @param base Input base LiDAR file.
#' @param subset Input subset LiDAR file.
#' @param output Output LiDAR file.
#' @param subset_class Subset point class value (must be 0-18; see LAS specifications).
#' @param nonsubset_class Non-subset point class value (must be 0-18; see LAS specifications).
#' @param wd Changes the working directory. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_wd()` for details.
#' @param verbose_mode Sets verbose mode. If verbose mode is `FALSE`, tools will not print output messages. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_verbose()` for details.
#' @param compress_rasters Sets the flag used by 'WhiteboxTools' to determine whether to use compression for output rasters. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_compress_rasters()` for details.
#' @param command_only Return command that would be executed by `system()` rather than running tool. Default: `FALSE`.
#'
#' @keywords LiDARTools
#'
#' @return Returns the tool text outputs.
#' @export
wbt_lidar_classify_subset <- function(base, subset, output, subset_class, nonsubset_class=NULL, wd=NULL, verbose_mode=NULL, compress_rasters=NULL, command_only=FALSE) {
wbt_init()
args <- ""
args <- paste(args, paste0("--base=", wbt_file_path(base)))
args <- paste(args, paste0("--subset=", wbt_file_path(subset)))
args <- paste(args, paste0("--output=", wbt_file_path(output)))
args <- paste(args, paste0("--subset_class=", wbt_file_path(subset_class)))
if (!is.null(nonsubset_class)) {
args <- paste(args, paste0("--nonsubset_class=", nonsubset_class))
}
if (!missing(wd)) {
args <- paste(args, paste0("--wd=", wbt_file_path(wd)))
}
if (!missing(compress_rasters)) {
args <- paste(args, paste0("--compress_rasters=", compress_rasters))
}
tool_name <- "lidar_classify_subset"
wbt_run_tool(tool_name, args, verbose_mode, command_only)
}
#' @title Lidar colourize
#'
#' @description Adds the red-green-blue colour fields of a LiDAR (LAS) file based on an input image.
#'
#' @param in_lidar Input LiDAR file.
#' @param in_image Input colour image file.
#' @param output Output LiDAR file.
#' @param wd Changes the working directory. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_wd()` for details.
#' @param verbose_mode Sets verbose mode. If verbose mode is `FALSE`, tools will not print output messages. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_verbose()` for details.
#' @param compress_rasters Sets the flag used by 'WhiteboxTools' to determine whether to use compression for output rasters. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_compress_rasters()` for details.
#' @param command_only Return command that would be executed by `system()` rather than running tool. Default: `FALSE`.
#'
#' @keywords LiDARTools
#'
#' @return Returns the tool text outputs.
#' @export
wbt_lidar_colourize <- function(in_lidar, in_image, output, wd=NULL, verbose_mode=NULL, compress_rasters=NULL, command_only=FALSE) {
wbt_init()
args <- ""
args <- paste(args, paste0("--in_lidar=", wbt_file_path(in_lidar)))
args <- paste(args, paste0("--in_image=", wbt_file_path(in_image)))
args <- paste(args, paste0("--output=", wbt_file_path(output)))
if (!missing(wd)) {
args <- paste(args, paste0("--wd=", wbt_file_path(wd)))
}
if (!missing(compress_rasters)) {
args <- paste(args, paste0("--compress_rasters=", compress_rasters))
}
tool_name <- "lidar_colourize"
wbt_run_tool(tool_name, args, verbose_mode, command_only)
}
#' @title Lidar contour
#'
#' @description This tool creates a vector contour coverage from an input LiDAR point file.
#'
#' @param input Name of the input LiDAR points.
#' @param output Name of the output vector lines file.
#' @param interval Contour interval.
#' @param base Base contour.
#' @param smooth Smoothing filter size (in num. points), e.g. 3, 5, 7, 9, 11.
#' @param parameter Interpolation parameter; options are 'elevation' (default), 'intensity', 'user_data'.
#' @param returns Point return types to include; options are 'all' (default), 'last', 'first'.
#' @param exclude_cls Optional exclude classes from interpolation; Valid class values range from 0 to 18, based on LAS specifications. Example, --exclude_cls='3,4,5,6,7,18'.
#' @param minz Optional minimum elevation for inclusion in interpolation.
#' @param maxz Optional maximum elevation for inclusion in interpolation.
#' @param max_triangle_edge_length Optional maximum triangle edge length; triangles larger than this size will not be gridded.
#' @param wd Changes the working directory. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_wd()` for details.
#' @param verbose_mode Sets verbose mode. If verbose mode is `FALSE`, tools will not print output messages. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_verbose()` for details.
#' @param compress_rasters Sets the flag used by 'WhiteboxTools' to determine whether to use compression for output rasters. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_compress_rasters()` for details.
#' @param command_only Return command that would be executed by `system()` rather than running tool. Default: `FALSE`.
#'
#' @keywords LiDARTools
#'
#' @return Returns the tool text outputs.
#' @export
wbt_lidar_contour <- function(input, output=NULL, interval=10.0, base=0.0, smooth=5, parameter="elevation", returns="all", exclude_cls=NULL, minz=NULL, maxz=NULL, max_triangle_edge_length=NULL, wd=NULL, verbose_mode=NULL, compress_rasters=NULL, command_only=FALSE) {
wbt_init()
args <- ""
args <- paste(args, paste0("--input=", wbt_file_path(input)))
if (!is.null(output)) {
args <- paste(args, paste0("--output=", wbt_file_path(output)))
}
if (!is.null(interval)) {
args <- paste(args, paste0("--interval=", interval))
}
if (!is.null(base)) {
args <- paste(args, paste0("--base=", base))
}
if (!is.null(smooth)) {
args <- paste(args, paste0("--smooth=", smooth))
}
if (!is.null(parameter)) {
args <- paste(args, paste0("--parameter=", parameter))
}
if (!is.null(returns)) {
args <- paste(args, paste0("--returns=", returns))
}
if (!is.null(exclude_cls)) {
args <- paste(args, paste0("--exclude_cls=", exclude_cls))
}
if (!is.null(minz)) {
args <- paste(args, paste0("--minz=", minz))
}
if (!is.null(maxz)) {
args <- paste(args, paste0("--maxz=", maxz))
}