Skip to content

Commit 8089f39

Browse files
committed
update examples
1 parent b5dfb21 commit 8089f39

File tree

2 files changed

+36
-9
lines changed

2 files changed

+36
-9
lines changed

README.Rmd

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,21 +48,33 @@ Just some basic examples for package usage.
4848
```{r get_extent}
4949
library(managelidar)
5050
51+
# create various valid input paths
5152
folder <- system.file("extdata", package = "managelidar")
5253
las_files <- list.files(folder, full.names = T, pattern = "*.laz")
53-
las_file <- las_files[1]
54-
vpc_file <- tempfile(fileext = ".vpc"); lasR::exec(lasR::write_vpc(vpc_file, absolute_path = TRUE), on = las_files)
54+
las_file <- las_files[1]
55+
vpc_file <- tempfile(fileext = ".vpc")
56+
lasR::exec(lasR::write_vpc(vpc_file, absolute_path = TRUE), on = las_files)
5557
vpc_obj <- yyjsonr::read_json_file(vpc_file)
5658
mixed <- c(folder, las_file)
5759
58-
paths <- list(folder, las_files, las_file, vpc_file, vpc_obj, mixed)
60+
paths <- list(folder, las_files, las_file, vpc_file, vpc_obj, mixed)
5961
60-
# get the Coordinate reference system for all types of input
62+
# get the Coordinate Reference System for all types of input
6163
lapply(paths, get_crs)
6264
6365
# get the extent (bbox) from LASfiles
6466
get_extent(las_files)
6567
68+
# get names of files intersecting an extent
69+
las_files |>
70+
filter_spatial(c(547900, 5724900, 548100, 5724900)) |>
71+
get_names()
72+
73+
# combine with temporal filter
74+
las_files |>
75+
filter_temporal("2024-03") |>
76+
filter_spatial(c(547900, 5724900, 548100, 5724900)) |>
77+
get_names()
6678
```
6779

6880

README.md

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,19 @@ Just some basic examples for package usage.
5353
``` r
5454
library(managelidar)
5555

56+
# create various valid input paths
5657
folder <- system.file("extdata", package = "managelidar")
5758
las_files <- list.files(folder, full.names = T, pattern = "*.laz")
58-
las_file <- las_files[1]
59-
vpc_file <- tempfile(fileext = ".vpc"); lasR::exec(lasR::write_vpc(vpc_file, absolute_path = TRUE), on = las_files)
60-
#> [1] "C:\\Users\\JWIESE~1\\AppData\\Local\\Temp\\RtmpWm4m4p\\file13f832ae6ba3.vpc"
59+
las_file <- las_files[1]
60+
vpc_file <- tempfile(fileext = ".vpc")
61+
lasR::exec(lasR::write_vpc(vpc_file, absolute_path = TRUE), on = las_files)
62+
#> [1] "C:\\Users\\JWIESE~1\\AppData\\Local\\Temp\\RtmpghBJtg\\file16ffcbda271a.vpc"
6163
vpc_obj <- yyjsonr::read_json_file(vpc_file)
6264
mixed <- c(folder, las_file)
6365

64-
paths <- list(folder, las_files, las_file, vpc_file, vpc_obj, mixed)
66+
paths <- list(folder, las_files, las_file, vpc_file, vpc_obj, mixed)
6567

66-
# get the Coordinate reference system for all types of input
68+
# get the Coordinate Reference System for all types of input
6769
lapply(paths, get_crs)
6870
#> [[1]]
6971
#> filename crs
@@ -111,4 +113,17 @@ get_extent(las_files)
111113
#> 2 3dm_32_547_5725_1_ni_20240327.laz 547648 5725000 547998.1 5725991
112114
#> 3 3dm_32_548_5724_1_ni_20240327.laz 548000 5724000 548992.0 5724997
113115
#> 4 3dm_32_548_5725_1_ni_20240327.laz 548000 5725000 548995.4 5725992
116+
117+
# get names of files intersecting an extent
118+
las_files |>
119+
filter_spatial(c(547900, 5724900, 548100, 5724900)) |>
120+
get_names()
121+
#> [1] "3dm_32_547_5724_1_ni_20240327.laz" "3dm_32_548_5724_1_ni_20240327.laz"
122+
123+
# combine with temporal filter
124+
las_files |>
125+
filter_temporal("2024-03") |>
126+
filter_spatial(c(547900, 5724900, 548100, 5724900)) |>
127+
get_names()
128+
#> [1] "3dm_32_547_5724_1_ni_20240327.laz" "3dm_32_548_5724_1_ni_20240327.laz"
114129
```

0 commit comments

Comments
 (0)