TransWikia.com

R lidR CRS as WKT

Geographic Information Systems Asked on August 3, 2021

I would like to solve the warning I receive when I read in a set of laz files using readLASCatalog in the R package lidR.

When I use this code I receive this warning:

library(lidR)
ctg_test <- readLAScatalog ("c:/temp/t/laz")
#> Warning messages:
#> 1: This LAS object stores the CRS as WKT. 0 returned; use 'wkt()' instead.

When I look at one of the laz files,

las = readLAS("c:/Temp/t/laz/in2018_28402265_12.laz")
#> Warning message:
#> There are 748 points flagged 'withheld'. 

More details

las
#> class        : LAS (v1.4 format 6)
#> memory       : 788.5 Mb 
#> extent       : 2840000, 2845000, 2265000, 2270000 (xmin, xmax, ymin, ymax)
#> coord. ref.  : NAD83(HARN) / Indiana West (ftUS) + NAVD88 height - Geoid12B (ftUS) (with axis order normalized for visualization) (with axis order normalized for visualization) 
#> area         : 25 kus-ft²
#> points       : 8.99 million points
#> density      : 0.36 points/us-ft²
las@header
#> File signature:           LASF 
#> File source ID:           0 
#> Global encoding:
#>  - GPS Time Type: Standard GPS Time 
#>  - Synthetic Return Numbers: no 
#>  - Well Know Text: CRS is WKT 
#>  - Aggregate Model: false 
#> Project ID - GUID:        b601ab3f-37a8-43c3-328d-f1f5a00b66e4 
#> Version:                  1.4
#> System identifier:        Woolpert LAS 
#> Generating software:      GeoCue LAS Updater 
#> File creation d/y:        248/2018
#> header size:              375 
#> Offset to point data:     1483 
#> Num. var. length record:  1 
#> Point data format:        6 
#> Point data record length: 30 
#> Num. of point records:    8986941 
#> Num. of points by return: 8073636 687316 199022 25963 1004 0 0 0 0 0 0 0 0 0 0 
#> Scale factor X Y Z:       0.01 0.01 0.01 
#> Offset X Y Z:             0 0 0 
#> min X Y Z:                2840000 2265000 573.24 
#> max X Y Z:                2845000 2270000 2086.6 
#> Variable length records: 
#>    Variable length record 1 of 1 
#>        Description: OGC WKT Coordinate System 
#>        WKT OGC COORDINATE SYSTEM: COMPD_CS["NAD83(HARN) / Indiana West (ftUS) + NAVD88 height - Geoid12B [...] (truncated) 

Where/how exactly do I use wkt() in my catalog function to remedy the warnings I receive? I am using version 3.1.1 of the lidR package.

One Answer

This is a small issue in readLAScatalog(). LAS format 1.4 is not supported as well as LAS formats < 1.4. An other related question has been asked few days ago (R lidR does not read the CRS of my las file). lidR >= 3.1.2 will have a better support of LAS 1.4. And with rlas 1.4 it will have an even better support.

Meanwhile you can simply get rid of the warning:

ctg_test <- suppressWarnings(readLAScatalog("c:/temp/t/laz"))

Notice that the CRS is not read by readLAScatalog() because of the issue mentioned. Something like that may work if the WKT string is valid which is often not the case I believe.

h = readLASheader(ctg_test$filename[1])
crs = sp::CRS(SRS_string = wkt(h))
projection(ctg_test) <- crs

Correct answer by JRR on August 3, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP