AnsweredAssumed Answered

LasDataset to Raster through Interpolation

Question asked by limgeomatics_u2 on Feb 25, 2015

Hello,

 

I want to use the ILasSurface.InterpolateRaster method to get a DSM raster from the LasDataset but it only works if I pass in a RasterDataset that was created with LONG pixel type - what I really want is DOUBLE or FLOAT. However, the method throws a "Value does not fall within the expected range" argument exception if I pass it a RasterDataset that is DOUBLE or FLOAT. Is it even possible to get this result? Why would it be locked to LONG type?

 

public IRasterDataset3 LasDatasetToDSM(ILasDataset lasDataset, IGeometry envelope)
        {
            esriSurfaceInterpolationType interpolationType = esriSurfaceInterpolationType.esriNaturalNeighborInterpolation
            ILasSurface lasSurface = lasDataset.CreateDynamicSurface();
            
            ILasFilter lasFilter = (ILasFilter)new LasFilter();
            lasFilter.AreaOfInterest = envelope;
            ILongArray @returns = new LongArray();
            @returns.Add(1);
            lasFilter.Returns = @returns;
            IRasterDataset rd = CreateTempRasterDataset(envelope.Envelope, LTK.Properties.Settings.Default.Cellsize, rstPixelType.PT_FLOAT);
            try
            {
                System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
                sw.Start();
                lasSurface.InterpolateRaster(null, lasFilter, rd, -1, esriTinPointSelectionMethod.esriTinPointSelectionZmax, interpolationType, 1.0);
                sw.Stop();
                Logger.Log("DSM Created in " + sw.Elapsed.ToString());
                return rd;
            }
            catch (Exception e)
            {
                Logger.Log(e.Message + " " + e.StackTrace, LogLevel.Error);
            }
            return null;
        }

Outcomes