管道基础大数据平台系统开发-【CS】-ExportMap
13693261870
2024-07-19 402fdc4cb6f94016cf9749bb1f09a6c5ead5d6d3
SimuTools/Tools/GdalHelper.cs
@@ -180,7 +180,7 @@
        /// <summary>
        /// 创建PNG
        /// </summary>
        public void CreatePng(string filePath, int width, int height, int bands = 3)
        public void CreatePng(byte[] buffer, string filePath, int width, int height, int bands = 3)
        {
            // 创建内存驱动
            OSGeo.GDAL.Driver memDriver = Gdal.GetDriverByName("MEM");
@@ -192,13 +192,6 @@
            {
                Band band = ds.GetRasterBand(i);
                band.SetRasterColorInterpretation((ColorInterp)i);
            }
            // 填充内存图像
            byte[] buffer = new byte[width * height * bands];
            for (int i = 0; i < buffer.Length; i++)
            {
                buffer[i] = (byte)(i % 256);
            }
            // 写入内存图像