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")
lambertj
  • 3,037
  • 3
  • 18
  • 37
Purple_Ad
  • 55
  • 4

1 Answers1

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.

JRR
  • 9,389
  • 1
  • 13
  • 28