Пример #1
0
 public FakeRaster(decimal fTop, decimal fLeft, decimal dCellHeight, decimal dCellWidth, double fNoData,
                   Raster.RasterDriver psDriver, GdalDataType eDataType, string psProjection, string psUnit,
                   U[,] grid) : base(fTop, fLeft, dCellHeight, dCellWidth, grid.GetLength(1), grid.GetLength(0),
                                     fNoData, psDriver, eDataType, psProjection, psUnit)
 {
     _inputgrid  = grid;
     _outputGrid = new U[grid.GetLength(0), grid.GetLength(1)];
     _outputGrid.Fill <U>(NodataValue <U>());
 }
Пример #2
0
        public void CreateDS(Raster.RasterDriver driver, FileInfo finfo, ExtentRectangle theExtent, Projection proj, GdalDataType theType)
        {
            List <string> creationOpts = new List <string>();

            switch (driver)
            {
            case Raster.RasterDriver.GTiff:
                creationOpts.Add("COMPRESS=LZW");
                break;

            case Raster.RasterDriver.HFA:
                creationOpts.Add("COMPRESS=PACKBITS");
                break;
            }
            Driver driverobj = Gdal.GetDriverByName(Enum.GetName(typeof(Raster.RasterDriver), driver));

            _ds = driverobj.Create(finfo.FullName, theExtent.Cols, theExtent.Rows, 1, theType._origType, creationOpts.ToArray());
            _ds.SetGeoTransform(theExtent.Transform);
            _ds.SetProjection(proj.OriginalString);

            SetNoData((double)origNodataVal);
        }