Skip to content

Commit

Permalink
use ScannerChannel
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-Romain committed Aug 29, 2023
1 parent b6d3755 commit b5c1002
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
### rlas v1.6.4

- support of Text Area Description [#64](https://github.com/r-lidar/rlas/pull/64)
- `header_create()` now take into account `ScannerChannel`

### rlas v1.6.3

Expand Down
38 changes: 19 additions & 19 deletions R/header_tools.r
Original file line number Diff line number Diff line change
Expand Up @@ -434,28 +434,28 @@ guess_las_format <- function(data)
{
fields <- names(data)

formats = 0:10
formats = formats[!formats %in% c(4L, 5L, 9L, 10L)] # not supported

if ("NIR" %in% fields) # format 8 or 10
return(8L) # Format 10 is not supported
formats = formats[!formats %in% c(8L)]

if ("gpstime" %in% fields) # format 1, 3:10
{
if (all(c("R", "G", "B") %in% fields)) # format 3, 5, 7, 8
{
if ("ScanAngle" %in% fields)
return(7L) # It is not 8 because NIR has already been tested
else
return(3L)
}
else # format 1
return(1L)
}
else # format 0 or 2
{
if (all(c("R", "G", "B") %in% fields))
return(2L)
else
return(0L)
}
formats = formats[formats %in% c(1L, 3:10)]

if (all(c("R", "G", "B") %in% fields)) # format 3, 5, 7, 8
formats = formats[formats %in% c(3L, 5L, 7L, 8L)]

if ("ScanAngle" %in% fields)
formats = formats[formats > 5]

if ("ScannerChannel" %in% fields)
formats = formats[formats > 5]

if (length(format) == 0)
stop("No point format id found.")

return(min(formats))
}

guess_scale_factor <- function(x)
Expand Down

0 comments on commit b5c1002

Please sign in to comment.