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

---
 ExportMap/demoMap.html     |   75 +++++++++++++++++++++++++++++++++++++
 ExportMap/ExportMap.csproj |    1 
 ExportMap/Sources/xyz.py   |    9 +++-
 ExportMap/export.html      |    2 
 4 files changed, 83 insertions(+), 4 deletions(-)

diff --git a/ExportMap/ExportMap.csproj b/ExportMap/ExportMap.csproj
index fc49a68..0289adc 100644
--- a/ExportMap/ExportMap.csproj
+++ b/ExportMap/ExportMap.csproj
@@ -104,6 +104,7 @@
   <ItemGroup>
     <Content Include="api.html" />
     <Content Include="crds.html" />
+    <Content Include="demoMap.html" />
     <Content Include="DLL\log4net4.dll" />
     <Content Include="DLL\Mono.Security.dll" />
     <Content Include="DLL\Npgsql.dll" />
diff --git a/ExportMap/Sources/xyz.py b/ExportMap/Sources/xyz.py
index fd63ff0..acb3e18 100644
--- a/ExportMap/Sources/xyz.py
+++ b/ExportMap/Sources/xyz.py
@@ -28,8 +28,8 @@
     parser = argparse.ArgumentParser(description='ArgUtils')
     parser.add_argument("-src", type=str, default=get_full_path(), required=False)
     parser.add_argument("-qgz", type=str, default=r"xyz.qgz", required=False)
-    parser.add_argument("-file", type=str, default=r"D:\xyz\dom0.2m\tif.txt", required=False)
-    parser.add_argument("-out", type=str, default=r"D:\xyz\dom0.2m\png", required=False)
+    parser.add_argument("-file", type=str, default=r"D:\xyz\domtt\tif.txt", required=False)
+    parser.add_argument("-out", type=str, default=r"D:\xyz\domtt\png", required=False)
     parser.add_argument("-min", type=int, default=12, required=False)
     parser.add_argument("-max", type=int, default=18, required=False)
     parser.add_argument("-noData", type=int, default=0, required=False)
@@ -72,7 +72,10 @@
             prj.setCrs(layer.crs())
 
         for j in range(1, layer.bandCount() + 1):
-            layer.dataProvider().setNoDataValue(j, args.noData)
+            try:
+                layer.dataProvider().setNoDataValue(j, args.noData)
+            except Exception as e:
+                print(e)
 
         prj.addMapLayer(layer)
 
diff --git a/ExportMap/demoMap.html b/ExportMap/demoMap.html
new file mode 100644
index 0000000..6d713c1
--- /dev/null
+++ b/ExportMap/demoMap.html
@@ -0,0 +1,75 @@
+<!doctype html>
+<html lang="en">
+<head>
+  <meta charset="utf-8">
+  <link rel="stylesheet" href="https://openlayers.org/en/v4.6.5/css/ol.css" type="text/css">
+  <!-- The line below is only needed for old environments like Internet Explorer and Android 4.x -->
+  <script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=requestAnimationFrame,Element.prototype.classList,URL"></script>
+  <script src="https://openlayers.org/en/v4.6.5/build/ol.js"></script>
+  <!-- <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.13.0/css/ol.css" type="text/css"> -->
+  <style>
+    body {
+      margin: 0;
+      width: 100%;
+      height: 100vh;
+    }
+
+    .map-class {
+      height: 100%;
+      width: 100%;
+    }
+  </style>
+  <!-- 鍔犺浇OpenLayers 绫诲簱 -->
+  <!-- <script src="https://cdn.jsdelivr.net/npm/ol@v7.1.0/dist/ol.js"></script>
+  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/ol@v7.1.0/ol.css"> -->
+  <!-- <script src="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.13.0/build/ol.js"></script> -->
+  <title>OpenLayers渚嬪瓙</title>
+</head>
+<body>
+  <div id="map" class="map-class"></div>
+
+  <script type="text/javascript">
+    // 澶╁湴鍥惧簳鍥�
+    var source = new ol.source.XYZ({
+      url: 'http://127.0.0.1:8088/02/{z}/{x}/{y}.png'
+    })
+    var tileLayer = new ol.layer.Tile({
+      title: '澶╁湴鍥�',
+      source: source
+    });
+
+    var tlLayer = new ol.layer.Image({
+      source: new ol.source.ImageWMS({
+        //url: 'http://localhost:8097/geoserver/dtdt/wms',
+        url: "http://127.0.0.1:8088/geoserver/LF/wms",
+        params: {
+          'FORMAT': 'image/png',
+          'VERSION': '1.1.1',
+          //"LAYERS": 'dtdt:tl'
+          "LAYERS": 'LF:tl'
+        }
+      })
+    });
+
+    var map = new ol.Map({
+      target: 'map',
+      controls: ol.control.defaults({
+        attributionOptions: ({
+          collapsible: true
+        })
+      }),
+      layers: [
+        tileLayer, tlLayer
+      ],
+      view: new ol.View({
+        center: ol.proj.transform([105.02, 34.9], 'EPSG:4326', 'EPSG:3857'),
+        zoom: 4,
+        minZoom: 0,
+        maxZoom: 18,
+        //projection: "EPSG:4326"
+        projection: "EPSG:3857"
+      })
+    });
+  </script>
+</body>
+</html>
diff --git a/ExportMap/export.html b/ExportMap/export.html
index 1b59bed..01ef018 100644
--- a/ExportMap/export.html
+++ b/ExportMap/export.html
@@ -5,7 +5,7 @@
   <title></title>
   <script src="js/jquery.1.12.4.js"></script>
   <script>
-    var token = "6b1ccb44-d187-41a4-9e8e-5fde1cb53e9b";
+    var token = "d12b3854-17c1-46c1-8435-22b1c5892fe7";
 
     // Ajax
     function ajax(url, type, data, dataType, contentType, fn) {

--
Gitblit v1.9.3