1

I am working on the segmentation of crown canopy using LiDAR. I want to extract the crowns created after the segmentation as a shapefile. Other documentation and links show that using writeOGR I can create the shapefile from the crown canopy, but I get an error that:

inherits(obj, "Spatial") is not TRUE

Exporting crown boundaries from tree segmentation in R?

The code:

crowns <- crown_metrics(las, func = .stdtreemetrics, geom = "convex")
writeOGR(crowns, "building.shp", layer="convex", driver="ESRI Shapefile")

1 Answer 1

1

Since lidR 4.0.0 spatial objects returned by the package are in sf format. It no longer uses sp. The question you linked is old and lidR modernized the workflow one year ago. writeOGR was used in the good old time to write Spatial* object from sp. Modern spatial data in R now uses sf. You must use st_write from sf.

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.