Esempio n. 1
0
 public FY3L2L3FileProjector()
     : base()
 {
     _name            = "FY3L2L3";
     _fullname        = "FY3L2L3轨道文件投影";
     _rasterProjector = new RasterProjector();
     _srcSpatialRef   = SpatialReference.GetDefault();
 }
 public FY3L2L3FileProjector()
     : base()
 {
     _name            = "FY3L2L3";
     _fullname        = "FY3L2L3轨道文件投影";
     _rasterProjector = new RasterProjector();
     _srcSpatialRef   = SpatialReferenceFactory.CreateSpatialReference(4326);
 }
Esempio n. 3
0
 public HDF4FileProjector()
     : base()
 {
     _name            = "HDF4";
     _fullname        = "HDF4轨道文件投影";
     _rasterProjector = new RasterProjector();
     _srcSpatialRef   = SpatialReference.GetDefault();
 }
Esempio n. 4
0
 public FY2_NOMProjection()
     : base()
 {
     _name            = "FY2NOM";
     _fullname        = "FY2_NOM数据投影";
     _rasterProjector = new RasterProjector();
     _srcSpatialRef   = SpatialReferenceFactory.CreateSpatialReference(4326);
     _supportAngles   = new string[] { "NOMSatelliteZenith", "NOMSunGlintAngle", "NOMSunZenith" };
 }
Esempio n. 5
0
 public FY2_NOMProjection()
     : base()
 {
     _name            = "FY2NOM";
     _fullname        = "FY2_NOM数据投影";
     _rasterProjector = new RasterProjector();
     _srcSpatialRef   = new SpatialReference(new GeographicCoordSystem());
     _supportAngles   = new object[] { "NOMSatelliteZenith", "NOMSunGlintAngle", "NOMSunZenith" };
 }
Esempio n. 6
0
 public FY3_VIRRFileProjector()
     : base()
 {
     _name                = "FY3_VIRR";
     _fullname            = "FY3_VIRR轨道文件投影";
     _rasterProjector     = new RasterProjector();
     _srcSpatialRef       = SpatialReference.GetDefault();
     _supportExtBandNames = new string[] { "Height", "LandCover", "LandSeaMask" };
 }
 public FY3_VIRRFileProjector()
     : base()
 {
     _name                = "FY3_VIRR";
     _fullname            = "FY3_VIRR轨道文件投影";
     _rasterProjector     = new RasterProjector();
     _srcSpatialRef       = SpatialReferenceFactory.CreateSpatialReference(4326);
     _supportExtBandNames = new string[] { "Height", "LandCover", "LandSeaMask" };
     //_NODATA_VALUE = 65535;
 }
Esempio n. 8
0
        //private IRasterDataProvider _solarZenithCacheRaster = null;
        //protected short[] _sensorZenithData = null;

        //#region Session
        //PrjEnvelope _maxPrjEnvelope = null;
        //double[] _xs = null;    //存储的实际是计算后的值
        //double[] _ys = null;    //存储的实际是计算后的值
        //#endregion

        public FY1X_1A5FileProjector()
            : base()
        {
            _name            = "FY1X_1A5";
            _fullname        = "FY1X_1A5轨道文件投影";
            _rasterProjector = new RasterProjector();
            _srcSpatialRef   = new SpatialReference(new GeographicCoordSystem());
            _supportAngles   = new object[] { "SolarZenith", "SatelliteZenith", "RelativeAzimuth" };
            //_supportAngles = new object[] { "NOMSatelliteZenith", "NOMSunGlintAngle", "NOMSunZenith" };
        }
 public FY3_MERSIFileProjector()
     : base()
 {
     _name            = "FY3_MERSI";
     _fullname        = "FY3_MERSI轨道数据投影";
     _rasterProjector = new RasterProjector();
     _srcSpatialRef   = new SpatialReference(new GeographicCoordSystem());
     _outLdfDriver    = GeoDataDriver.GetDriverByName("LDF") as IRasterDataDriver;
     _left            = 10;
     _right           = 10;
 }
Esempio n. 10
0
        private static SDataByProject <T> DoProject <T>(T[,] sourcedata, T fillValue, ref Size outStepSize, ref Size srcStepSize, T[,] dstData, UInt16[] rows, UInt16[] cols)
        {
            //投影不同分块的数据集
            RasterProjector _rasterProjector = new RasterProjector();

            _rasterProjector.ProjectNew <T>(sourcedata, srcStepSize, rows, cols, outStepSize, dstData, fillValue);
            SDataByProject <T> returnvalue = new SDataByProject <T>();

            returnvalue.Data = dstData;
            return(returnvalue);
        }
 public FY3_MERSIFileProjector()
     : base()
 {
     _name            = "FY3_MERSI";
     _fullname        = "FY3_MERSI轨道数据投影";
     _rasterProjector = new RasterProjector();
     _srcSpatialRef   = SpatialReferenceFactory.CreateSpatialReference(4326);
     _left            = 10;
     _right           = 10;
     //_NODATA_VALUE = 65535;
 }
 public FY3B_MERSIFileProjector()
     : base()
 {
     _name                = "FY3B_MERSI";
     _fullname            = "FY3B_MERSI轨道数据投影";
     _rasterProjector     = new RasterProjector();
     _srcSpatialRef       = SpatialReferenceFactory.CreateSpatialReference(4326);
     _left                = 10;
     _right               = 10;
     _supportExtBandNames = new string[] { "DEM", "LandCover", "LandSeaMask" };
     //_NODATA_VALUE = 65535;
 }
Esempio n. 13
0
 public FY3C_MERSIFileProjector()
     : base()
 {
     _name                = "FY3C_MERSI";
     _fullname            = "FY3C_MERSI轨道数据投影";
     _rasterProjector     = new RasterProjector();
     _srcSpatialRef       = new SpatialReference(new GeographicCoordSystem());
     _outLdfDriver        = GeoDataDriver.GetDriverByName("LDF") as IRasterDataDriver;
     _left                = 10;
     _right               = 10;
     _supportExtBandNames = new string[] { "DEM", "LandCover", "LandSeaMask" };
 }
Esempio n. 14
0
 public ProjectedFileTransform()
 {
     _name            = "ProjectedTransform";
     _fullname        = "自定义文件投影转换";
     _rasterProjector = new RasterProjector();
 }
Esempio n. 15
0
        private void TestProj()
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            Size srSize = Size.Empty;

            Double[] lats  = null;
            Double[] longs = null;
            using (IRasterDataProvider srcPrd = GeoDataDriver.Open(@"D:\masData\FY3A_VIRRX_GBAL_L1_20110322_0525_1000M_MS.HDF") as IRasterDataProvider)
            {
                using (IBandProvider srcbandpro = srcPrd.BandProvider as IBandProvider)
                {
                    srSize = new System.Drawing.Size(srcPrd.Width, srcPrd.Height);
                    lats   = new Double[srcPrd.Width * srcPrd.Height];
                    longs  = new Double[srcPrd.Width * srcPrd.Height];
                    using (IRasterBand latBand = srcbandpro.GetBands("Latitude")[0])
                    {
                        using (IRasterBand lonsBand = srcbandpro.GetBands("Longitude")[0])
                        {
                            unsafe
                            {
                                fixed(Double *ptrLat = lats)
                                {
                                    fixed(Double *ptrLong = longs)
                                    {
                                        IntPtr bufferPtrLat  = new IntPtr(ptrLat);
                                        IntPtr bufferPtrLong = new IntPtr(ptrLong);

                                        latBand.Read(0, 0, srcPrd.Width, srcPrd.Height, bufferPtrLat, enumDataType.Double, srcPrd.Width, srcPrd.Height);
                                        lonsBand.Read(0, 0, srcPrd.Width, srcPrd.Height, bufferPtrLong, enumDataType.Double, srcPrd.Width, srcPrd.Height);
                                    }
                                }
                            }
                        }
                    }
                    stopwatch.Stop();
                    WriteLine("读取经纬度{0}ms", stopwatch.ElapsedMilliseconds);
                    stopwatch.Restart();
                    IRasterProjector     raster = new RasterProjector();
                    PrjEnvelope          destEnvelope;
                    Action <int, string> progressCallback = new Action <int, string>(OutProgress);
                    //progressCallback = null;  //测试不用进度条的情况
                    ISpatialReference srcSpatialRef = SpatialReferenceFactory.GetSpatialReferenceByPrjFile("WGS 1984.prj");
                    ISpatialReference dstSpatialRef = SpatialReferenceFactory.GetSpatialReferenceByPrjFile("ChinaBoundary.prj");
                    raster.ComputeDstEnvelope(srcSpatialRef, longs, lats, srSize, dstSpatialRef, out destEnvelope, progressCallback);
                    stopwatch.Stop();
                    WriteLine("计算范围{0}ms", stopwatch.ElapsedMilliseconds);
                    WriteLine("范围{0}", destEnvelope.ToString());

                    Size     dstSize           = new Size((int)(destEnvelope.Width / 0.01), (int)(destEnvelope.Height / 0.01));
                    UInt16[] dstRowLookUpTable = new UInt16[dstSize.Width * dstSize.Height];
                    UInt16[] dstColLookUpTable = new UInt16[dstSize.Width * dstSize.Height];
                    raster.ComputeIndexMapTable(srcSpatialRef, longs, lats, srSize, dstSpatialRef, dstSize, destEnvelope,
                                                out dstRowLookUpTable, out dstColLookUpTable, progressCallback);

                    stopwatch.Stop();
                    WriteLine("计算投影查找表{0}ms", stopwatch.ElapsedMilliseconds);
                    stopwatch.Restart();

                    int srcBandCount = srcPrd.BandCount;
                    using (IRasterDataDriver drv = GeoDataDriver.GetDriverByName("LDF") as IRasterDataDriver)
                    {
                        string proj4 = dstSpatialRef.ToProj4String();
                        using (IRasterDataProvider prdWriter = drv.Create(@"d:\Myproj4LutX.ldf", dstSize.Width, dstSize.Height, srcBandCount,
                                                                          enumDataType.UInt16, "INTERLEAVE=BSQ", "VERSION=LDF", "SPATIALREF=" + proj4) as IRasterDataProvider)
                        {
                            UInt16[] dstData = new UInt16[dstSize.Width * dstSize.Height];
                            UInt16[] srcData = new UInt16[srSize.Width * srSize.Height];
                            //int perProgress = 0;
                            //int curProgress = 0;
                            for (int i = 0; i < srcBandCount; i++)
                            {
                                using (IRasterBand latBand = srcPrd.GetRasterBand(i + 1))
                                {
                                    unsafe
                                    {
                                        fixed(UInt16 *ptr = srcData)
                                        {
                                            IntPtr bufferptr = new IntPtr(ptr);

                                            latBand.Read(0, 0, srSize.Width, srSize.Height, bufferptr, enumDataType.UInt16, srSize.Width, srSize.Height);
                                        }
                                    }
                                }
                                //stopwatch.Stop();
                                //WriteLine("读取一个通道{0}ms,通道索引{1}", stopwatch.ElapsedMilliseconds, i + 1);
                                //stopwatch.Restart();
                                raster.Project <UInt16>(srcData, srSize, dstRowLookUpTable, dstColLookUpTable, dstSize, dstData, 0, progressCallback);
                                //stopwatch.Stop();
                                //WriteLine("投影一个通道{0}ms,通道索引{1}", stopwatch.ElapsedMilliseconds, i + 1);
                                //stopwatch.Restart();

                                using (IRasterBand band = prdWriter.GetRasterBand(i + 1))
                                {
                                    unsafe
                                    {
                                        fixed(UInt16 *ptr = dstData)
                                        {
                                            IntPtr bufferPtr = new IntPtr(ptr);

                                            band.Write(0, 0, band.Width, band.Height, bufferPtr, enumDataType.UInt16, band.Width, band.Height);
                                        }
                                    }
                                }
                                //curProgress = (i+1) * 100 / srcBandCount;
                                //if (progressCallback != null && curProgress > perProgress)
                                //{
                                //    progressCallback(curProgress, "");
                                //    perProgress = curProgress;
                                //}
                                //stopwatch.Stop();
                                //WriteLine("写出一个通道{0}ms", stopwatch.ElapsedMilliseconds);
                                //stopwatch.Restart();
                            }
                        }
                    }
                    stopwatch.Stop();
                    WriteLine("投影完所有通道{0}ms", stopwatch.ElapsedMilliseconds);
                    stopwatch.Restart();
                }
            }
        }
Esempio n. 16
0
 public GeosProject()
 {
     _name            = "GeosProject";
     _fullname        = "静止卫星投影";
     _rasterProjector = new RasterProjector();
 }