From adffca71aba3ed339dc0484900e7c866d52d5f33 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期五, 10 三月 2023 10:50:51 +0800
Subject: [PATCH] 1

---
 ExportMap/Sources/xyz.py |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/ExportMap/Sources/xyz.py b/ExportMap/Sources/xyz.py
index 345a8f6..049ef8c 100644
--- a/ExportMap/Sources/xyz.py
+++ b/ExportMap/Sources/xyz.py
@@ -51,22 +51,26 @@
 
     lines = readTxt(args.file)
     for i in range(0, len(lines)):
-        line = lines[i]
-        if len(line) == 0:
+        if len(lines[i]) == 0:
             continue
 
-        print("layer: " + line)
-        layer = QgsRasterLayer(line, "layer_" + str(i))
+        print("layer: " + lines[i])
+        layer = QgsRasterLayer(lines[i], "layer_" + str(i))
         if not layer.isValid() or layer.crs() is None:
             print("layer_" + str(i) + ": failed to load!")
             continue
 
         if len(prj.mapLayers()) == 0:
             prj.setCrs(layer.crs())
+
+        for j in range(1, layer.bandCount() + 1):
+            layer.dataProvider().setNoDataValue(j, 0)
+
         prj.addMapLayer(layer)
 
     for layer in prj.mapLayers().values():
-        print(layer.name() + ": " + layer.extent().toString())
+        print(layer.name() + ", " + layer.extent().toString() + ", " + layer.crs().authid())
+
 
 # 鍒濆鍖�
 def init():

--
Gitblit v1.9.3