• 大小: 2.97MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-10-28
  • 语言: C#
  • 标签:

资源简介

内含所有源代码,对于利用GDAL进行多幅影像进行图层叠加的小伙伴会有参考的,可能会有不足,但是代码是自己花了多半天弄出来的(VS2010 ),需要的朋友拿走把。效率挺高的,个人测试超过了ENVI的Layer Stacking效率。

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;

namespace GDALReadWriteData
{
    public partial class frmGDALReadWrite : Form
    {
        public frmGDALReadWrite()
        {
            InitializeComponent();
        }

        string inputFile;
        string outputFile;

        private void btnReadWriteData_Click(object sender EventArgs e)
        {
            bool isDone = false;
            DateTime start = DateTime.Now;
            //**************进度条**************//
            frmProgressBar proFrm = new frmProgressBar();
            //修改进度条显示文字
            proFrm.UpDateInfo(“正在读写影像...“);
            proFrm.TopMost = true;
            proFrm.Show();
            Thread thread0 = new Thread(() =>
            {
                //****************执行语句**********************

                GDALReadWrite gdalReadWrite = new GDALReadWrite(inputFiles);
                    ProgramRunTime temp = new ProgramRunTime();
                    temp.TimeStart();                
                    gdalReadWrite.ReadToWrite(inputFile outputFile);
                    Console.WriteLine(temp.TimeConsuming());
              
                //*********************************************

                if (proFrm.InvokeRequired)
                    proFrm.Invoke(new frmProgressBar.CloseProgressFrm(proFrm.ClosePro));
                GC.Collect();
                isDone = true;
            });
            thread0.SetApartmentState(ApartmentState.STA);
            thread0.Priority = ThreadPriority.Highest;
            thread0.Start();
            proFrm.Visible = false;
            proFrm.ShowDialog();

            if (thread0.IsAlive)
            {
                Thread.Sleep(600);
                thread0.Abort();
            }
            thread0 = null;
            GC.Collect();
            DateTime stop = DateTime.Now;
            string timeConsuming = Convert.ToString(stop - start);
            timeConsuming = “\r\n开始时间:“ + start + “\r\n结束时间:“ + stop + “\r\n耗时:“ + timeConsuming;   
            //**************进度条**************//
            if (isDone)
            {
                MessageBox.Show(“GDAL读写数据完毕!“+timeConsuming);
                Close();
            }

        }

        string[] inputFiles;
        private void btnData_Click(object sender EventArgs e)
        {
            OpenFileDialog getFile = new OpenFileDialog();
            getFile.Multiselect = true;
            if (getFile.ShowDialog() == DialogResult.OK)
            {
                inputFile = getFile.FileName;
                inputFiles = new string[getFile.FileNames.Length];
                for (int i = 0; i < getFile.FileNames.Length; i++)
                {
                    inputFiles[i] = getFile.FileNames[i];
            

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        144  2017-06-03 17:21  09_多景单幅影像进行图层叠加操作\GDALReadWriteData\app.config

     文件    7057408  2017-06-17 09:35  09_多景单幅影像进行图层叠加操作\GDALReadWriteData\bin\Debug\gdal19.dll

     文件      18944  2013-04-27 14:46  09_多景单幅影像进行图层叠加操作\GDALReadWriteData\bin\Debug\gdalconst_csharp.dll

     文件      12288  2013-04-27 14:46  09_多景单幅影像进行图层叠加操作\GDALReadWriteData\bin\Debug\gdalconst_wrap.dll

     文件      25088  2018-02-01 22:38  09_多景单幅影像进行图层叠加操作\GDALReadWriteData\bin\Debug\GDALReadWriteData.exe

     文件        144  2017-06-03 17:21  09_多景单幅影像进行图层叠加操作\GDALReadWriteData\bin\Debug\GDALReadWriteData.exe.config

     文件      62976  2018-02-01 22:38  09_多景单幅影像进行图层叠加操作\GDALReadWriteData\bin\Debug\GDALReadWriteData.pdb

     文件      11600  2018-02-02 18:21  09_多景单幅影像进行图层叠加操作\GDALReadWriteData\bin\Debug\GDALReadWriteData.vshost.exe

     文件        144  2017-06-03 17:21  09_多景单幅影像进行图层叠加操作\GDALReadWriteData\bin\Debug\GDALReadWriteData.vshost.exe.config

     文件        490  2016-07-16 19:44  09_多景单幅影像进行图层叠加操作\GDALReadWriteData\bin\Debug\GDALReadWriteData.vshost.exe.manifest

     文件      90112  2013-04-27 14:46  09_多景单幅影像进行图层叠加操作\GDALReadWriteData\bin\Debug\gdal_csharp.dll

     文件      94208  2013-04-27 14:46  09_多景单幅影像进行图层叠加操作\GDALReadWriteData\bin\Debug\gdal_wrap.dll

     文件     118784  2013-04-27 14:46  09_多景单幅影像进行图层叠加操作\GDALReadWriteData\bin\Debug\ogr_csharp.dll

     文件      94208  2013-04-27 14:46  09_多景单幅影像进行图层叠加操作\GDALReadWriteData\bin\Debug\ogr_wrap.dll

     文件      57344  2013-04-27 14:46  09_多景单幅影像进行图层叠加操作\GDALReadWriteData\bin\Debug\osr_csharp.dll

     文件      39424  2013-04-27 14:46  09_多景单幅影像进行图层叠加操作\GDALReadWriteData\bin\Debug\osr_wrap.dll

     文件       3653  2018-02-01 19:53  09_多景单幅影像进行图层叠加操作\GDALReadWriteData\FrmMain.cs

     文件       6062  2016-06-22 15:39  09_多景单幅影像进行图层叠加操作\GDALReadWriteData\FrmMain.Designer.cs

     文件      13383  2016-06-22 15:39  09_多景单幅影像进行图层叠加操作\GDALReadWriteData\FrmMain.resx

     文件       8126  2018-02-02 18:22  09_多景单幅影像进行图层叠加操作\GDALReadWriteData\GDALReadWrite.cs

     文件       5365  2017-06-03 17:23  09_多景单幅影像进行图层叠加操作\GDALReadWriteData\GDALReadWriteData.csproj

     文件        227  2016-06-22 14:04  09_多景单幅影像进行图层叠加操作\GDALReadWriteData\GDALReadWriteData.csproj.user

     文件       1975  2015-10-29 19:29  09_多景单幅影像进行图层叠加操作\GDALReadWriteData\icon\13221819.gif

     文件       2284  2015-10-29 19:29  09_多景单幅影像进行图层叠加操作\GDALReadWriteData\icon\open_32.png

     文件       2125  2016-06-22 15:00  09_多景单幅影像进行图层叠加操作\GDALReadWriteData\icon\save_320.png

     文件       1244  2015-10-29 19:29  09_多景单幅影像进行图层叠加操作\GDALReadWriteData\icon\删除.png

     文件       5988  2018-02-01 19:52  09_多景单幅影像进行图层叠加操作\GDALReadWriteData\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache

     文件       7068  2018-02-02 18:21  09_多景单幅影像进行图层叠加操作\GDALReadWriteData\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件      16782  2018-02-02 18:21  09_多景单幅影像进行图层叠加操作\GDALReadWriteData\obj\x86\Debug\GDALReadWriteData.csproj.FileListAbsolute.txt

     文件       1091  2016-08-07 21:53  09_多景单幅影像进行图层叠加操作\GDALReadWriteData\obj\x86\Debug\GDALReadWriteData.csproj.GenerateResource.Cache

............此处省略760个文件信息

评论

共有 条评论

相关资源