예제 #1
0
        public void TestFy3VIRR()
        {
            IRasterDataProvider srcRaster = null;

            try
            {
                IFileProjector proj = FileProjector.GetFileProjectByName("FY3_VIRR");
                srcRaster = GetSrcRaster();
                FY3_VIRR_PrjSettings prjSetting    = GetPrjSetting(srcRaster);
                ISpatialReference    dstSpatialRef = SpatialReference.GetDefault();//默认的WGS84等经纬度投影。
                //dstSpatialRef = SpatialReference.FromPrjFile(@"North Pole Stereographic.prj");
                proj.Project(srcRaster, prjSetting, dstSpatialRef, ProgressCallback);
                Console.WriteLine();
            }
            finally
            {
                if (srcRaster != null)
                {
                    if (srcRaster.BandProvider != null)
                    {
                        srcRaster.BandProvider.Dispose();
                    }
                    srcRaster.Dispose();
                }
            }
        }
예제 #2
0
        private void PrjVIRR(string file)
        {
            IRasterDataProvider srcRaster = null;

            try
            {
                IFileProjector proj = FileProjector.GetFileProjectByName("FY3_VIRR");
                srcRaster = GetSrcRaster(file);
                FY3_VIRR_PrjSettings prjSetting = new FY3_VIRR_PrjSettings();
                prjSetting.OutPathAndFileName = @"D:\T.ldf";
                ISpatialReference dstSpatialRef = SpatialReference.GetDefault();
                proj.Project(srcRaster, prjSetting, dstSpatialRef, null);
                MessageBox.Show("FY3_VIRR" + "投影输出文件" + @"D:\T.ldf");
            }
            finally
            {
                if (srcRaster != null)
                {
                    if (srcRaster.BandProvider != null)
                    {
                        srcRaster.BandProvider.Dispose();
                    }
                    srcRaster.Dispose();
                }
            }
        }
예제 #3
0
        private FilePrjSettings GetFilePrjSettings(IRasterDataProvider prd)
        {
            FY3_VIRR_PrjSettings settings = new FY3_VIRR_PrjSettings();
            BandMap map = new BandMap();

            map.File        = prd;
            map.DatasetName = "EV_RefSB";
            map.BandIndex   = 0;
            settings.BandMapTable.Add(map);
            settings.OutResolutionX     = 0.01f;
            settings.OutResolutionY     = 0.01f;
            settings.OutEnvelope        = new GeoDo.RasterProject.PrjEnvelope(86, 136, 19, 60);
            settings.OutFormat          = "LDF";
            settings.OutPathAndFileName = "f:\\Out.LDF";
            return(settings);
        }
예제 #4
0
        private FY3_VIRR_PrjSettings GetPrjSetting(IRasterDataProvider srcRaster)
        {
            string               dstFilename = @"D:\fy3VIRR_Block.ldf";
            PrjEnvelope          dstEnvelope = PrjEnvelope.CreateByCenter(78.621416, 32.189639, 36.00, 26.00);
            FY3_VIRR_PrjSettings prjSetting  = new FY3_VIRR_PrjSettings();

            prjSetting.OutPathAndFileName = dstFilename;    //必填
            //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;       //default true
            return(prjSetting);
        }
예제 #5
0
        private void PrjVIRR(string file)
        {
            IRasterDataProvider srcRaster = null;

            try
            {
                PrjEnvelope[] prjEnvelopes = new PrjEnvelope[]
                {
                    PrjEnvelope.CreateByCenter(100, 30, 10, 10),
                    PrjEnvelope.CreateByCenter(110, 29, 10, 10),
                    PrjEnvelope.CreateByCenter(105, 28, 10, 10),
                    PrjEnvelope.CreateByCenter(105, 27, 10, 10),
                    PrjEnvelope.CreateByCenter(105, 26, 10, 10),
                    PrjEnvelope.CreateByCenter(105, 25, 10, 10),
                    PrjEnvelope.CreateByCenter(105, 24, 10, 10),
                    PrjEnvelope.CreateByCenter(105, 23, 10, 10),
                    PrjEnvelope.CreateByCenter(105, 22, 10, 10),
                    PrjEnvelope.CreateByCenter(105, 21, 10, 10),
                    PrjEnvelope.CreateByCenter(105, 20, 10, 10)
                };
                Stopwatch stopwatch = new Stopwatch();
                stopwatch.Start();
                srcRaster = GetSrcRaster(file);
                IFileProjector proj = FileProjector.GetFileProjectByName("FY3_VIRR");
                proj.BeginSession(srcRaster);
                for (int i = 0; i < prjEnvelopes.Length; i++)
                {
                    try
                    {
                        GeoDo.RasterProject.PrjEnvelope prjEnvelope = prjEnvelopes[i];
                        FY3_VIRR_PrjSettings            prjSetting  = new FY3_VIRR_PrjSettings();
                        prjSetting.OutPathAndFileName = GetOutPutFile(file, i);
                        prjSetting.OutEnvelope        = prjEnvelope;
                        prjSetting.OutResolutionX     = 0.0025F;
                        prjSetting.OutResolutionY     = 0.0025F;
                        ISpatialReference dstSpatialRef = SpatialReference.GetDefault();
                        proj.Project(srcRaster, prjSetting, dstSpatialRef, _progressCallback);
                        stopwatch.Stop();
                        WriteLine("数据投影{0}ms", stopwatch.ElapsedMilliseconds);
                        this.Text = prjSetting.OutPathAndFileName;
                    }
                    catch (Exception ex)
                    {
                        this.Text = ex.Message;
                    }
                }
                proj.EndSession();
                stopwatch.Stop();
                WriteLine("数据投影{0}ms", stopwatch.ElapsedMilliseconds);
            }
            finally
            {
                if (srcRaster != null)
                {
                    if (srcRaster.BandProvider != null)
                    {
                        srcRaster.BandProvider.Dispose();
                    }
                    srcRaster.Dispose();
                }
                GC.Collect();
            }
        }