0

I have computed a vegetation index for my point clouds and have added it as a new attribute to my LAS file, and saved the updated las file using the following code-

lz <- readLAS('x.laz')
rgb <- lz@data[, c("R", "G", "B")]
VI <- (2 * rgb[, "G"] - rgb[, "R"] - rgb[, "B"]) / (2 * rgb[, "G"] + rgb[, "R"] + rgb[, "B"])
VI_vector <- as.numeric(VI$i)
lz_v <- add_lasattribute_manual(lz, VI_vector, "Veg_index", "VI", type="float")
writeLAS(lz_v, "lz_v.las")

Although I can access and visualize the newly added attribute (lz_v@data$VI) in R, I am facing difficulties displaying it in ArcGIS Pro/QGIS for symbology purposes. When I try to use the attribute for symbology, it does not appear in the list of available attributes.

5
  • How do you define "green" or "greeness"? I can help in coding a solution but I can't help defining the problem you want to solve.
    – JRR
    Commented Mar 1 at 9:42
  • I plan to use visual band difference (VI) to set approximate threshold for greenness just like NDVI. As below: lz = readLAS('x.laz'); rgb <- lz@data[, c("R", "G", "B")]; VI <- (2 * rgb[, "G"] - rgb[, "R"] - rgb[, "B"]) / (2 * rgb[, "G"] + rgb[, "R"] + rgb[, "B"]); VI_vector <- as.numeric(VI$i); lz_v <- add_lasattribute_manual(lz, VI_vector, "Veg_index", "VI", type="float"); writeLAS(lz_v , "lz_v.las") Now, issue is even after adding attribute (accessible with (lz_veg@data$VI) and plotting too in R) I can't see it in ArcPRO as attribute for symbology. Can you help with this? Commented Mar 1 at 13:58
  • This is a whole different question. Please edit you question and title to ask your actual question
    – JRR
    Commented Mar 1 at 16:21
  • Sorry @JRR, I just made some progress after posting question that is why comment seemed different. Have corrected it now. Commented Mar 1 at 18:21
  • You have two questions in one. One is about extra attribute display in arcgis the other one is about filtering filter point in lidR. If your question does not focus a single problem a moderator will likely close your question. Please open two focused questions.
    – JRR
    Commented Mar 1 at 18:33

1 Answer 1

0

Your vegetation index is properly written in an extra byte attribute. If you do not know how to display it with arcgis or if arcgis is not able to display it is likely not related to lidR.

Minimal reproducible example

library(lidR)

# Generate a dummy but valid las file with  RGB
LASfile <- system.file("extdata", "Megaplot.laz", package="lidR")
lz = readLAS(LASfile)
lz@data$R = as.integer(runif(npoints(lz), 0, 2^16-1))
lz@data$G = as.integer(runif(npoints(lz), 0, 2^16-1))
lz@data$B = as.integer(runif(npoints(lz), 0, 2^16-1))
lz = LAS(lz@data)

VI <- (2 * lz$G - lz$R - lz$B) / (2 * lz$G + lz$R + lz$B)
lz_v <- add_lasattribute_manual(lz, VI, "VI", "Vegetation index", type="float")

o = tempfile(fileext = ".las")
writeLAS(lz_v, o)

lz2 = readLAS(o, select = "0")
lz2@data
#>               X       Y     Z          VI
#>           <num>   <num> <num>       <num>
#>     1: 684992.2 5018007 17.30  0.04546750
#>     2: 684992.6 5018006 17.03  0.12521845
#>     3: 684993.0 5018005 16.14 -0.77577966
#>     4: 684993.1 5018006 11.10 -0.04777577
#>     5: 684993.2 5018001 17.58  0.81007040
#>    ---                                   
#> 81586: 684945.1 5018004  2.45 -0.48434746
#> 81587: 684944.3 5018007 13.20 -0.23157750
#> 81588: 684946.4 5018005  2.40  0.28080842
#> 81589: 684947.4 5018006  0.00  0.16323362
#> 81590: 684947.2 5018007  0.86  0.02827319

Created on 2024-03-01 with reprex v2.1.0

1
  • I see this, thanks @JRR I will move further. Commented Mar 2 at 14:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.