예제 #1
0
        public static DataIdentify Match(string fname)
        {
            if (string.IsNullOrEmpty(fname))
            {
                return(null);
            }
            fname = Path.GetFileName(fname).ToUpper();
            DataIdentify it = new DataIdentify();

            it.Satellite     = GetSatellite(fname);
            it.Sensor        = GetSensor(fname);
            it.OrbitDateTime = GetOrbitDateTime(fname);
            return(it);
        }
예제 #2
0
 /// <summary>
 /// 拷贝非空值
 /// </summary>
 /// <param name="targetDataIdentify"></param>
 public void CopyAttributesToIfNull(DataIdentify targetDataIdentify)
 {
     if (string.IsNullOrEmpty(targetDataIdentify.Satellite))
     {
         targetDataIdentify.Satellite = Satellite;
     }
     if (string.IsNullOrEmpty(targetDataIdentify.Sensor))
     {
         targetDataIdentify.Sensor = Sensor;
     }
     if (DateTime.MinValue == targetDataIdentify.OrbitDateTime)
     {
         targetDataIdentify.OrbitDateTime = OrbitDateTime;
     }
     if (targetDataIdentify.DayOrNight == enumDayOrNight.Null)
     {
         targetDataIdentify.DayOrNight = DayOrNight;
     }
 }
예제 #3
0
        private string[] LdfOptions(FilePrjSettings prjSettings, SpatialReference dstSpatial, float resolutionX, float resolutionY, DataIdentify dataIdentify)
        {
            List <string> options = new List <string>();

            options.Add("INTERLEAVE=BSQ");
            options.Add("VERSION=LDF");
            options.Add("SPATIALREF=" + dstSpatial.ExportToProj4());
            options.Add("MAPINFO={" + 1 + "," + 1 + "}:{" + prjSettings.OutEnvelope.MinX + "," + prjSettings.OutEnvelope.MaxY + "}:{" + resolutionX + "," + resolutionY + "}");
            options.Add("SENSOR=NOM");
            if (dataIdentify != null)
            {
                string   satellite = dataIdentify.Satellite;
                DateTime dt        = dataIdentify.OrbitDateTime;
                bool     asc       = dataIdentify.IsAscOrbitDirection;
                if (!string.IsNullOrWhiteSpace(satellite))
                {
                    options.Add("SATELLITE=" + satellite);
                }
                if (dt != DateTime.MinValue && dt != DateTime.MaxValue)
                {
                    options.Add("DATETIME=" + dt.ToString("yyyy/MM/dd HH:mm"));
                }
            }
            return(options.ToArray());
        }
예제 #4
0
        private AbstractWarpDataset CreateOutFile(FilePrjSettings prjSettings, SpatialReference dstSpatial, DataIdentify dataIdentify)
        {
            float resolutionX = prjSettings.OutResolutionX;
            float resolutionY = prjSettings.OutResolutionY;

            string[] options   = null;
            string   outformat = string.IsNullOrWhiteSpace(prjSettings.OutFormat) ? ".ldf" : prjSettings.OutFormat.ToLower();
            string   driver    = "";

            if (outformat == ".ldf" || outformat == ".tiff")
            {
                driver  = "GDAL";
                options = new string[] {
                    "DRIVERNAME=GTiff",
                    "TFW=YES",
                    "WKT=" + dstSpatial.ExportToWkt(),
                    "GEOTRANSFORM=" + string.Format("{0},{1},{2},{3},{4},{5}", prjSettings.OutEnvelope.MinX, resolutionX, 0, prjSettings.OutEnvelope.MaxY, 0, -resolutionY)
                };
            }
            else
            {
                driver  = "LDF";
                options = LdfOptions(prjSettings, dstSpatial, resolutionX, resolutionY, dataIdentify);
                List <string> opts = new List <string>(options);
                opts.Add("BANDNAMES=" + BandNameString(prjSettings.OutBandNos));
                options = opts.ToArray();
            }
            Size   outSize   = prjSettings.OutEnvelope.GetSize(resolutionX, resolutionY);
            int    bandCount = prjSettings.OutBandNos.Length;
            string filename  = prjSettings.OutPathAndFileName;

            return(CreateOutFile(driver, filename, bandCount, outSize, DataType.GDT_Int16, options));
        }