From bc425adbda376e5ad30f269c0a9ebae2d12de44f Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期一, 22 五月 2023 14:25:46 +0800
Subject: [PATCH] 1

---
 ExportMap/Sources/merge.py |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/ExportMap/Sources/merge.py b/ExportMap/Sources/merge.py
index 274d3f6..3171edf 100644
--- a/ExportMap/Sources/merge.py
+++ b/ExportMap/Sources/merge.py
@@ -98,6 +98,22 @@
     processing.run("gdal:merge", ops)
 
 
+# 鑾峰彇涓績鐐瑰潗鏍�
+def get_coord(prj, args):
+    layer = QgsRasterLayer(args.out, "layer_tif")
+    rect = layer.extent()
+    x = (rect.xMinimum() + rect.xMaximum()) / 2
+    y = (rect.yMinimum() + rect.yMaximum()) / 2
+    sid = layer.crs().authid()
+
+    coord = str(x) + ", " + str(y) + ", " + str(sid)
+    print(coord)
+
+    f = open(args.out.replace(".tif", "_cs.txt"), 'w')
+    f.write(coord)
+    f.close()
+
+
 # 鍒濆鍖�
 def init():
     # QgsApplication.setPrefixPath("C:\Program Files\QGIS 3.16", True)
@@ -113,6 +129,7 @@
 
     load_layers(prj, args)
     merge(prj, args)
+    get_coord(prj, args)
 
     qgs.exitQgis()
 

--
Gitblit v1.9.3