public void GetBandData() { string fname = "d:\\NOAA18_AVHRR_CHINA_L1_20090806_N3_1000M.dat"; IRasterDataDriver drv = GeoDataDriver.GetDriverByName("GDAL") as IRasterDataDriver; IRasterDataProvider prd = drv.Open(fname, enumDataProviderAccess.ReadOnly) as IRasterDataProvider;// GeoDataDriver.Open(fname) as IRasterDataProvider; IRasterBand rb = prd.GetRasterBand(3); UInt16[] buffer = new UInt16[prd.Width * prd.Height]; unsafe { fixed(UInt16 *ptr = buffer) { IntPtr bufferPtr = new IntPtr(ptr); //prd.Read(0, 0, prd.Width, prd.Height, bufferPtr, enumDataType.UInt16, prd.Width, prd.Height, 1, new int[] { 1 }, enumInterleave.BSQ); rb.Read(0, 0, prd.Width, prd.Height, bufferPtr, enumDataType.UInt16, prd.Width, prd.Height); } } string filename = "d:\\d.dat"; FileStream fs = new FileStream(filename, FileMode.Create); BinaryWriter bw = new BinaryWriter(fs); for (int i = 0; i < buffer.Length; i++) { bw.Write(buffer[i]); } fs.Close(); }
public void OpenBSQFile_GDAL_FullSize() { IRasterDataDriver drv = GeoDataDriver.GetDriverByName("GDAL") as IRasterDataDriver; IRasterDataProvider prd = drv.Open(_fnameBSQ, enumDataProviderAccess.ReadOnly) as IRasterDataProvider;// OpenLdfFile(_fnameBSQ); Assert.Greater(prd.BandCount, 0); ReadOneBandByFullSize(prd, 1, "D:\\GDAL_LDF"); prd.Dispose(); }
public void ReadAngleInfo() { string fname = "d:\\0111d2.n16.1bd"; IRasterDataDriver driver = GeoDataDriver.GetDriverByName("NOAA_1BD") as IRasterDataDriver; Assert.NotNull(driver); IRasterDataProvider prd = driver.Open(fname, enumDataProviderAccess.ReadOnly) as IRasterDataProvider; D1BDDataProvider dp = prd as D1BDDataProvider; }
public void CreateCopy() { string fname = "E:\\DST_DBLV_FY3A_VIRR_1000M_DXX_P001_200911131352.MVG"; IRasterDataDriver drv = GeoDataDriver.GetDriverByName("MVG") as IRasterDataDriver; string dstName = "E:\\Copy.MVG"; IRasterDataProvider srcprd = drv.Open(fname, enumDataProviderAccess.ReadOnly) as IRasterDataProvider; IRasterDataProvider dstprd = drv.CreateCopy(dstName, srcprd); Assert.True(File.Exists(dstName)); dstprd.Dispose(); srcprd.Dispose(); }
public void CreateCopy() { string fname = @"D:\\FY3A_Mersi_2010_06_24_10_00_1000M_L1B_PRJ_Whole.LDF"; IRasterDataDriver drv = GeoDataDriver.GetDriverByName("LDF") as IRasterDataDriver; string dstfname = "d:\\CreateCopy.ldf"; IRasterDataProvider srcprd = drv.Open(fname, enumDataProviderAccess.ReadOnly) as IRasterDataProvider; IRasterDataProvider dstprd = drv.CreateCopy(dstfname, srcprd); Assert.True(File.Exists(dstfname)); dstprd.Dispose(); srcprd.Dispose(); }
public void CreateCopyWithFillZero() { string fname = @"E:\\DST_DBLV_FY3A_VIRR_1000M_DXX_P001_200911131352.MVG"; IRasterDataDriver drv = GeoDataDriver.GetDriverByName("MVG") as IRasterDataDriver; string dstfname = "e:\\CreateCopy_Zero.mvg"; IRasterDataProvider srcprd = drv.Open(fname, enumDataProviderAccess.ReadOnly) as IRasterDataProvider; IRasterDataProvider dstprd = drv.CreateCopy(dstfname, srcprd); for (int b = 1; b <= dstprd.BandCount; b++) { dstprd.GetRasterBand(b).Fill(0); } Assert.True(File.Exists(dstfname)); dstprd.Dispose(); srcprd.Dispose(); }
public void CreateCopyWithFillZero() { string fname = @"D:\\FY3A_Mersi_2010_06_24_10_00_1000M_L1B_PRJ_Whole.LDF"; IRasterDataDriver drv = GeoDataDriver.GetDriverByName("LDF") as IRasterDataDriver; string dstfname = "d:\\CreateCopy_Zero.ldf"; IRasterDataProvider srcprd = drv.Open(fname, enumDataProviderAccess.ReadOnly) as IRasterDataProvider; IRasterDataProvider dstprd = drv.CreateCopy(dstfname, srcprd); for (int b = 1; b <= dstprd.BandCount; b++) { dstprd.GetRasterBand(b).Fill(0); } Assert.True(File.Exists(dstfname)); dstprd.Dispose(); srcprd.Dispose(); }
public void ClipDataProvider() { string fname = "d:\\ce110429n18.ldf"; //IRasterDataProvider prd = GeoDataDriver.Open(fname) as IRasterDataProvider; IRasterDataDriver driver = GeoDataDriver.GetDriverByName("GDAL") as IRasterDataDriver; Assert.NotNull(driver); IRasterDataProvider prd = driver.Open(fname, enumDataProviderAccess.ReadOnly) as IRasterDataProvider; Console.WriteLine(prd.CoordEnvelope.Height); Console.WriteLine(prd.CoordEnvelope.Width); Console.WriteLine(prd.Height); Console.WriteLine(prd.Width); RasterClipProcesser cp = new RasterClipProcesser(); //BlockDef block=new BlockDef("a", }
public void ReadIRCoefficient() { string fname = "d:\\NOAA18_AVHRR_CHINA_L1_20090806_N3_1000M.1bd"; IRasterDataDriver driver = GeoDataDriver.GetDriverByName("NOAA_1BD") as IRasterDataDriver; Assert.NotNull(driver); IRasterDataProvider prd = driver.Open(fname, enumDataProviderAccess.ReadOnly) as IRasterDataProvider; D1BDDataProvider dp = prd as D1BDDataProvider; double[,] a = null; double[,] b = null; dp.ReadIRCoefficient(ref a, ref b); for (int i = 0; i < 4; i++) { for (int j = 0; j < 9; j++) { Console.WriteLine(a[i, j]); } Console.WriteLine("\n"); } }