r-lidar / lidR

Airborne LiDAR data manipulation and visualisation for forestry application
https://CRAN.R-project.org/package=lidR
GNU General Public License v3.0
596 stars 131 forks source link

readLAS does not have trouble at reading incompatible files #315

Closed Jean-Romain closed 4 years ago

Jean-Romain commented 4 years ago

The following two files are incompatible because of difference scale factors, different CRS but yet readLAS can read them at once without even a warning> it should at least warn.

library(lidR)
#> Le chargement a nécessité le package : raster
#> Le chargement a nécessité le package : sp

LASfile1 <- system.file("extdata", "Megaplot.laz", package="lidR")
LASfile2 <- system.file("extdata", "Topography.laz", package="lidR")

readLASheader(LASfile1)
#> File signature:           LASF 
#> File source ID:           0 
#> Global encoding:
#>  - GPS Time Type: GPS Week Time 
#>  - Synthetic Return Numbers: no 
#>  - Well Know Text: CRS is GeoTIFF 
#>  - Aggregate Model: false 
#> Project ID - GUID:        00000000-0000-0000-0000-000000000000 
#> Version:                  1.2
#> System identifier:        LAStools (c) by rapidlasso GmbH 
#> Generating software:      las2las (version 171231) 
#> File creation d/y:        0/0
#> header size:              227 
#> Offset to point data:     321 
#> Num. var. length record:  1 
#> Point data format:        1 
#> Point data record length: 28 
#> Num. of point records:    81590 
#> Num. of points by return: 55756 21493 3999 342 0 
#> Scale factor X Y Z:       0.01 0.01 0.01 
#> Offset X Y Z:             0 0 0 
#> min X Y Z:                684766.4 5017773 0 
#> max X Y Z:                684993.3 5018007 29.97 
#> Variable length records: 
#>    Variable length record 1 of 1 
#>        Description: by LAStools of rapidlasso GmbH 
#>        Tags:
#>           Key 1024 value 1 
#>           Key 3072 value 26917 
#>           Key 3076 value 9001 
#>           Key 4099 value 9001
readLASheader(LASfile2)
#> File signature:           LASF 
#> File source ID:           0 
#> Global encoding:
#>  - GPS Time Type: Standard GPS Time 
#>  - Synthetic Return Numbers: no 
#>  - Well Know Text: CRS is GeoTIFF 
#>  - Aggregate Model: false 
#> Project ID - GUID:        00000000-0000-0000-0000-000000000000 
#> Version:                  1.2
#> System identifier:         
#> Generating software:      rlas R package 
#> File creation d/y:        0/2018
#> header size:              227 
#> Offset to point data:     297 
#> Num. var. length record:  1 
#> Point data format:        1 
#> Point data record length: 28 
#> Num. of point records:    73403 
#> Num. of points by return: 53538 15828 3569 451 16 
#> Scale factor X Y Z:       0.00025 0.00025 0.00025 
#> Offset X Y Z:             270000 5270000 0 
#> min X Y Z:                273357.1 5274357 788.9932 
#> max X Y Z:                273642.9 5274643 829.7582 
#> Variable length records: 
#>    Variable length record 1 of 1 
#>        Description: by LAStools of rapidlasso GmbH 
#>        Tags:
#>           Key 3072 value 2949

las = readLAS(c(LASfile1, LASfile2))

Created on 2020-01-17 by the reprex package (v0.3.0)

Jean-Romain commented 4 years ago