tiagodc / TreeLS

R functions for processing individual tree TLS point clouds
GNU General Public License v3.0
82 stars 27 forks source link

treePoints saying crs does not match, treeMap removes crs #18

Closed jdonager closed 4 years ago

jdonager commented 4 years ago

Hi again, I am trying to use the treePoints function in conjunction with treeMap(). When I run treeMap, the las object that is returned has no CRS argument. So when I use it within the treePoints function, it gives an error: Error in .local(x, y, returnList, fn, ...) : identicalCRS(x, y) is not TRUE If I set the CRS argument of the map object to that of the las object so that they do in fact match, I get the same error. Interestingly, las objects without a CRS argument do not see this error and I cannot figure out how to remove the CRS argument from the las object. If needed, I can provide the las object. Thanks.

Jean-Romain commented 4 years ago

Please show a minimal reproducible example of code.

jdonager commented 4 years ago

crs(las) CRS arguments: +proj=utm +zone=12 +datum=WGS84 +units=m +no_defs map <- treeMap(las) crs(map) CRS arguments: NA trees <-treePoints(las, map, method = trp.voronoi()) Error in .local(x, y, returnList, fn, ...) : identicalCRS(x, y) is not TRUE crs(map) <- crs(las) crs(map) CRS arguments: +proj=utm +zone=12 +datum=WGS84 +units=m +no_defs trees <-treePoints(las, map, method = trp.voronoi()) Error in .local(x, y, returnList, fn, ...) : identicalCRS(x, y) is not TRUE

jdonager commented 4 years ago

a link to the .laz file: https://drive.google.com/file/d/1Rh_Jif47J01luUzfyZbXffn1VUwIipzx/view?usp=sharing

jdonager commented 4 years ago

las <- readLAS(location) crs(las) map <- treeMap(las) crs(map) trees <-treePoints(las, map, method = trp.voronoi()) crs(map) <- crs(las) crs(map) trees <-treePoints(las, map, method = trp.voronoi())

Jean-Romain commented 4 years ago

Seems that internal code drops the CRS somewhere. Definitively looks like a bug. I can't see where but it does not seem to be related to lidR so I let @tiagodc investigate.

jdonager commented 4 years ago

Great! Thanks for the incredibly prompt replies.

tiagodc commented 4 years ago

Just fixed. Indeed it was a bug in trp.voronoi. Thanks for pointing it out! You can reinstall the package from source now and it should work.

jdonager commented 4 years ago

Such a fast fix! Thanks, you guys are awesome.