LasDatasetToRaster does nothing to the Raster Layer

المشرف العام

Administrator
طاقم الإدارة
I have been trying to figure out how to clip and rasterize a LiDAR map file programmatically (Not through arcpy) I use C# but read many languages. So far I have been able to access and assign the LASD values but when I use ILasSurface.AsRaster or LasDatasetToRaster the RasterLayer outputs the same black square as if I did not call these functions. I can't find any documentation on this so I hope somebody can help.

public void RasterDatasetToMap(IRasterDataset rDataset, IPointFilter pf, IRasterDatasetLayer pRasterLayer) { ISpatialReference sr = new UnknownCoordinateSystemClass(); ITrackCancel2 tc = new CancelTrackerClass(); //Define the position and dimension of the raster dataset. IPoint origin = new PointClass(); origin.PutCoords(15.0, 15.0); int width = 100; //This is the width of the raster dataset. int height = 100; //This is the height of the raster dataset. double xCell = 30; //This is the cell size in x direction. double yCell = 30; //This is the cell size in y direction. int NumBand = 1; //Create new Raster Dataset try { rDataset = rWorkshop.CreateRasterDataset( "new raster layer - test 9", "TIFF", //filename and format origin, width, height, xCell, yCell, //Dimensions NumBand, rstPixelType.PT_FLOAT, sr, //Pixels, Spacial Reference true //Permenant? ); status += "Default RasterDatabase Set! \n"; } catch (Exception ex) { status += "Failed to create raster dataset: " + ex.Message + " " + status + "\n"; } //Set Point Filter try { pf = (ILasFilter)new LasFilter(); pf.AreaOfInterest = aview.Extent.Envelope; status += "Point Filter Set! \nDimensions: " + pf.AreaOfInterest.Envelope.Height + "x" + pf.AreaOfInterest.Envelope.Width + "\n"; } catch (Exception ex) { status += "Failed to create point filter: " + ex.Message + " " + status + "\n"; } //Rasterize Raster Dataset try { /* * Possible Methods */ LASSurface.AsRaster( tc, //Track Cancel pf, //Point Filter rDataset, //Output Raster Dataset //Rastering Options esriPointToRasterMethod.esriPointToRasterNearest, esriLasZSource.esriLasZSourceZ, esriPointToRasterVoidFillMethod.esriPointToRasterVoidFillInterpolation, esriSurfaceInterpolationType.esriLinearInterpolation, 1 ); /*LasDatasetToRaster conversion = new LasDatasetToRaster( LASDatasetLayer, rDataset );*/ status += "Rastering technique finished. Check map for validity. \n"; } catch (Exception ex) { status += "Failed to raster dataset: " + ex.Message + " " + status + "\n"; } //Experiment try { } catch (Exception ex) { status += "Failed to create tin: " + ex.Message + " " + status + "\n"; } //Create Raster Layer try { pRasterLayer = new RasterLayer(); pRasterLayer.CreateFromDataset(rDataset); status += "Default RasterLayer Set! \n"; } catch (Exception ex) { status += "Failed to create raster layer: " + ex.Message + " " + status + "\n"; } map.AddLayer(pRasterLayer); status += "Check Your Map! \n"; }

أكثر...
 
أعلى