private void PrjEos1000(string file, string locfile) { IRasterDataProvider srcRaster = null; IRasterDataProvider locRaster = null; try { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); IFileProjector proj = FileProjector.GetFileProjectByName("EOS"); srcRaster = GetSrcRaster(file); locRaster = GetSrcRaster(locfile); EOS_MODIS_PrjSettings prjSetting = new EOS_MODIS_PrjSettings(); prjSetting.OutPathAndFileName = GetOutPutFile(file); prjSetting.LocationFile = locRaster; ISpatialReference dstSpatialRef = GetOutSpatialRef(); proj.Project(srcRaster, prjSetting, dstSpatialRef, _progressCallback); stopwatch.Stop(); WriteLine("数据投影{0}ms", stopwatch.ElapsedMilliseconds); MessageBox.Show("投影输出文件" + prjSetting.OutPathAndFileName); } finally { if (srcRaster != null) { if (srcRaster.BandProvider != null) { srcRaster.BandProvider.Dispose(); } srcRaster.Dispose(); locRaster.Dispose(); } GC.Collect(); } }
private void PrjEos1000(string file, string locfile) { IRasterDataProvider srcRaster = null; IRasterDataProvider locRaster = null; try { IFileProjector proj = FileProjector.GetFileProjectByName("EOS"); srcRaster = GetSrcRaster(file); locRaster = GetSrcRaster(locfile); EOS_MODIS_PrjSettings prjSetting = new EOS_MODIS_PrjSettings(); prjSetting.OutPathAndFileName = @"D:\T.ldf"; prjSetting.LocationFile = locRaster; ISpatialReference dstSpatialRef = SpatialReference.GetDefault(); proj.Project(srcRaster, prjSetting, dstSpatialRef, null); MessageBox.Show("FY3_MERSI" + "投影输出文件" + @"D:\T.ldf"); } finally { if (srcRaster != null) { if (srcRaster.BandProvider != null) { srcRaster.BandProvider.Dispose(); } srcRaster.Dispose(); locRaster.Dispose(); } } }
public void TestProj() { IRasterDataProvider srcRaster = null; IRasterDataProvider location = null; try { IFileProjector proj = FileProjector.GetFileProjectByName("EOS"); srcRaster = GetSrcRaster(); location = GetLocationRaster(); EOS_MODIS_PrjSettings prjSetting = GetPrjSetting(srcRaster, location); ISpatialReference dstSpatialRef = SpatialReference.GetDefault(); //dstSpatialRef = SpatialReference.FromPrjFile(@"North Pole Lambert Azimuthal Equal Area.prj"); proj.Project(srcRaster, prjSetting, dstSpatialRef, _progressCallback); Console.WriteLine(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { if (srcRaster != null) { if (srcRaster.BandProvider != null) { srcRaster.BandProvider.Dispose(); } srcRaster.Dispose(); } } }
//[SetUp] public void DataReady(Action <int, string> progressCallback) { ///等经纬度投影 dstFilename = @"D:\mas数据\MODIS\TERRA_2010_03_25_03_09_GZ.MOD02HKM.ldf"; dstSpatialRef = SpatialReferenceFactory.GetSpatialReferenceByPrjFile("WGS 1984.prj"); // srcFilename = @"D:\mas数据\MODIS\TERRA_2010_03_25_03_09_GZ.MOD02HKM.HDF"; dstEnvelope = PrjEnvelope.CreateByCenter(110, 32, 5, 5); // string secondFile = @"D:\mas数据\MODIS\TERRA_2010_03_25_03_09_GZ.MOD03.HDF"; IRasterDataProvider secondFileRaster = GeoDataDriver.Open(secondFile) as IRasterDataProvider; srcRaster = GeoDataDriver.Open(srcFilename) as IRasterDataProvider; //List<BandMap> bandmapList = new List<BandMap>(); prjSetting = new EOS_MODIS_PrjSettings(); prjSetting.OutResolutionX = 0.0025F; prjSetting.OutResolutionY = 0.0025F; prjSetting.OutPathAndFileName = dstFilename; prjSetting.OutFormat = "LDF"; //prjSetting.OutEnvelope = dstEnvelope; //prjSetting.BandMapTable = bandmapList; //prjSetting.IsRadiation = false; prjSetting.SecondaryOrbitRaster = null; prjSetting.LocationFile = secondFileRaster; _progressCallback = progressCallback; }
private EOS_MODIS_PrjSettings GetPrjSetting(IRasterDataProvider srcRaster, IRasterDataProvider location) { string dstFilename = @"D:\TERRA_2012_03_16_02_56_GZ.MOD021KM.ldf"; PrjEnvelope dstEnvelope = PrjEnvelope.CreateByCenter(78.621416, 32.189639, 36.00, 26.00); //List<BandMap> bandmapList = new List<BandMap>(); EOS_MODIS_PrjSettings prjSetting = new EOS_MODIS_PrjSettings(); prjSetting.OutPathAndFileName = dstFilename; //必填 prjSetting.LocationFile = location; //经纬度坐标文件,必须指定 //prjSetting.OutResolutionX = 1000F; //default //prjSetting.OutResolutionY = 1000F; //default //prjSetting.OutFormat = "LDF"; //default //prjSetting.OutEnvelope = dstEnvelope; //default //prjSetting.BandMapTable = bandmapList;//default prjSetting.IsRadiation = true; //default true prjSetting.IsSolarZenith = true; return(prjSetting); }