From a1298c2750431e78dd4c8c57a80388b2bad615e3 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期二, 08 八月 2023 10:15:53 +0800
Subject: [PATCH] 1

---
 ExportMap/Sources/xyz2.py |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/ExportMap/Sources/xyz2.py b/ExportMap/Sources/xyz2.py
index fbbc24f..f69e57e 100644
--- a/ExportMap/Sources/xyz2.py
+++ b/ExportMap/Sources/xyz2.py
@@ -59,10 +59,13 @@
         if len(lines[i]) == 0:
             continue
 
-        print("layer_" + str(i) + ": " + lines[i])
-        layer = QgsRasterLayer(lines[i], "layer_" + str(i))
+        strs = lines[i].split(",")
+        prefix = "__" if "1" == strs[1] else "_"
+        print("layer" + prefix + str(i) + ": " + strs[0])
+
+        layer = QgsRasterLayer(strs[0], "layer" + prefix + str(i))
         if not layer.isValid() or layer.crs() is None:
-            print("layer_" + str(i) + ": failed to load!")
+            print("layer" + prefix + str(i) + ": failed to load!")
             continue
 
         for j in range(1, layer.bandCount() + 1):
@@ -111,10 +114,14 @@
     import processing
 
     for layer in prj.mapLayers().values():
+        if "layer__" in layer.id():
+            continue
+
         e = layer.extent()
         prj.setCrs(layer.crs())
         epsg = '' if layer.crs() is None else ' [' + layer.crs().authid() + ']'
-        args.ext = str(e.xMinimum()) + "," + str(e.xMaximum()) + "," + str(e.yMinimum()) + "," + str(e.yMaximum()) + epsg
+        args.ext = str(e.xMinimum()) + "," + str(e.xMaximum()) + "," + str(e.yMinimum()) + "," + str(
+            e.yMaximum()) + epsg
         ops = get_xyz_ops(args)
         processing.run("qgis:tilesxyzdirectory", ops)
 

--
Gitblit v1.9.3