From 4a77dcc80205b1c57ff3c2e1163e5d0793cd9e5f Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期三, 23 八月 2023 17:58:02 +0800
Subject: [PATCH] 修改读取栅格数据的接口-1

---
 DataLoader/CS/GdalHelper.cs |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/DataLoader/CS/GdalHelper.cs b/DataLoader/CS/GdalHelper.cs
index 1d74d74..177fa52 100644
--- a/DataLoader/CS/GdalHelper.cs
+++ b/DataLoader/CS/GdalHelper.cs
@@ -129,7 +129,8 @@
 
                 vd.Meta.bands = ds.RasterCount.ToString(); // 娉㈡鏁�
                 vd.Meta.band_type = Enum.GetName(typeof(DataType), ds.GetRasterBand(1).DataType); // 鏁版嵁绫诲瀷
-                vd.Meta.ct = ds.GetRasterBand(1).GetRasterColorTable().ToString(); // 鏁版嵁棰滆壊琛�
+                ColorTable ct = ds.GetRasterBand(1).GetRasterColorTable();
+                vd.Meta.ct = null == ct ? null : ct.ToString(); // 鏁版嵁棰滆壊琛�
                 vd.Meta.h_datum = null; // 楂樼▼鍩哄噯
 
                 double[] transform = new double[6];
@@ -168,7 +169,7 @@
 
             string epsg = ds.GetSpatialRef().GetAuthorityCode(null);
             double xMin = transform[0];
-            double yMin = transform[3];
+            double yMin = transform[3] - ds.RasterYSize * transform[1];
 
             Geometry point = new Geometry(wkbGeometryType.wkbPoint);
             point.AddPoint(xMin, yMin, 0);
@@ -186,7 +187,7 @@
 
             string epsg = ds.GetSpatialRef().GetAuthorityCode(null);
             double xMax = transform[0] + (ds.RasterXSize * transform[1]);
-            double yMax = transform[3] + (ds.RasterYSize * transform[1]);
+            double yMax = transform[3];
 
             Geometry point = new Geometry(wkbGeometryType.wkbPoint);
             point.AddPoint(xMax, yMax, 0);

--
Gitblit v1.9.3