Hello Edzer, Yes ! Super ! It worked ! Thank you so much for your suggestion. I converted the SpatialPoints object into object of class SpatiaPointsDataFrame. The function over() worked and I was able to substract the 2 Spatial*DataFrame's attributes, i.e., z from the TLS point cloud from the z of the DTM to obtain TLS canopy height. Thanks also for making me discover the r-sig-geo mailing list. Very efficient...!
Cheers, Nathalie -----Message d'origine----- De : [email protected] [mailto:[email protected]] De la part de Edzer Pebesma Envoyé : mercredi 10 octobre 2012 11:32 À : [email protected] Objet : Re: [R-sig-Geo] Substracting DTM from Terrestrial LiDAR point cloud On 10/10/2012 06:00 PM, Nathalie Morin wrote: > Hello ! > > > > I am working with georeferenced LiDAR data with R and sp. I am trying > to normalize height and remove the slope effect from a Terrestrial > Laser Scanner (TLS) point cloud. > > The available data is : > > - a TLS point cloud in ASCII format converted to sp objet of class > SpatialPoint (variable named "tls.z.sp") > > - a raster DTM in TIF format (1 m resolution) converted to sp > object of class SpatialGridDataFrame (variable named "tls.dtm$z") > > > > The method consists in subtracting the DTM z value from each TLS point > z value. I proceeded to some tests with the "over()" function with : Where is your TLS z value? If tls.z.sp is a 3D SpatialPoints object, I'd suggest to make it a 2D object with z as the attribute value, meaning it is a SpatialPointsDataFrame object. > > x = "SpatialPoints" > > y = "SpatialGridDataFrame" > > > > nz <- over(tls.z.sp, tls.dtm$z, tls.z.sp-tls.dtm$z) Hard to see, but maybe: nz = over(tls.z.sp, tls.dtm) then, if tls.z.sp is a SpatialPointsDataFrame with z as attribute: tls.z.sp$z - nz$z gives you the differences you want, and tls.z.sp$difference = tls.z.sp$z - nz$z adds them as a variable to the SpatialPointsDataFrame oject. > > > > I am not sure to be on the right track. Any suggestion would be very > much appreciated ! > > > > Cheers, > > Nathalie > > > > > [[alternative HTML version deleted]] > > _______________________________________________ > R-sig-Geo mailing list > [email protected] > https://stat.ethz.ch/mailman/listinfo/r-sig-geo > -- Edzer Pebesma Institute for Geoinformatics (ifgi), University of Münster Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251 8333081, Fax: +49 251 8339763 http://ifgi.uni-muenster.de http://www.52north.org/geostatistics [email protected] _______________________________________________ R-sig-Geo mailing list [email protected] https://stat.ethz.ch/mailman/listinfo/r-sig-geo _______________________________________________ R-sig-Geo mailing list [email protected] https://stat.ethz.ch/mailman/listinfo/r-sig-geo
