Closed Jean-Romain closed 7 years ago
Hi,
Could you please add function how to write individual tree boundary to shapefile after the lastrees segmentation?
Hi, could you please open a specific issue with more details about what you're expected. There are many way to achieve that.
Hi,
I need to convert the crown segmented to shapefiles format (ESRI shapefiles). I know this could be achieved in a few ways, like using writeogr function from rgdal package or using maptools, but i don't know how to start after get the crown (after run the lastrees). My R skills is kinda basic. The result is pretty convincing, but i need to get it analyse in arcgis to compare it with my field crown.
(using the example given in the doc)
At the end, if you chose a method that enable for an output of the crown in raster format (i.e. dalponte
or wartershed
using extra = T
). Then the raster
package have all the tools you need to process and analyse your rasters. You should look at rasterToPolygon
extra = lastrees(las, "dalponte2016", chm, th = 4, extra = TRUE)
library(raster)
crown.shp <- rasterToPolygons(extra$Crown, dissolve = TRUE)
plot(chm)
plot(crown.shp, add = T)
You can also convert that into convex hulls with rgeos
crown.hull <- rgeos::gConvexHull(crown.shp, byid = T)
Then, writreOGR
enable for writing a shapefile.
I'm not a specialist. You should look for better information from people who know more than me about these subjects. I can't teach you raster
sp
rgeos
or maptools
but I know that all you need already exists.
Hi,
Yes it works to transfer the raster to spatial polygon dataframe. Thanks so much. i just simply run it as crown.shp <- rasterToPolygons(extra, dissolve = TRUE) and to save it as shapefiles: library(maptools) writePolyShape(crown.shp, "extdata.shp")
It doesn't delineate correctly when i compare it with field data. But anyhow, if adding morphological gradient it will improve the delineation especially my forest is tropical forest. I'm trying to find the coding in R to add the morphological formula to aid with the watershed method.
See lidR results. Not able to reproduce the bug.