From a4beae69c590c496c6e01afd6ecf3e12e89d7ee0 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期四, 29 二月 2024 15:13:43 +0800
Subject: [PATCH] 1

---
 ExportMap/turf.html        |   42 ++++++++++++++++++++++++++++++++++++++++++
 ExportMap/up.html          |    3 +--
 ExportMap/ExportMap.csproj |    1 +
 3 files changed, 44 insertions(+), 2 deletions(-)

diff --git a/ExportMap/ExportMap.csproj b/ExportMap/ExportMap.csproj
index 15a64ea..ae87bdc 100644
--- a/ExportMap/ExportMap.csproj
+++ b/ExportMap/ExportMap.csproj
@@ -131,6 +131,7 @@
     <Content Include="TerraBuilder\tb.js" />
     <Content Include="TerraBuilder\template.js" />
     <Content Include="TerraBuilder\璇存槑.txt" />
+    <Content Include="turf.html" />
     <Content Include="UE.html" />
     <Content Include="up.html" />
     <Content Include="Web.config">
diff --git a/ExportMap/turf.html b/ExportMap/turf.html
new file mode 100644
index 0000000..5df966f
--- /dev/null
+++ b/ExportMap/turf.html
@@ -0,0 +1,42 @@
+锘�<!DOCTYPE>
+<html>
+<head>
+  <title>Turf.js</title>
+  <meta http-equiv="Expires" content="0" />
+  <meta http-equiv="Cache" content="no-cache" />
+  <meta http-equiv="Pragma" content="no-cache" />
+  <meta http-equiv="Cache-control" content="no-cache" />
+  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+  <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport" />
+  <script src="js/turf.min.6.5.js"></script>
+  <script>
+    function pointsToPolygon(str) {
+      var arr = eval(str);
+
+      var points = [];
+      for (var i = 0, c = arr.length; i < c; i += 2) {
+        var p = turf.point([arr[i], arr[i + 1]]);
+        points.push(p);
+      }
+
+      var fc = turf.featureCollection(points);
+      var hull = turf.convex(fc);
+      var area = turf.area(hull);
+
+      return area.toFixed(2);
+    }
+
+    window.onload = function () {
+      var str = "[113.23063216099904,31.21983148200005,113.23061312499972,31.219450768000044,113.23060360699967,31.21910812599997,113.2305679149997,31.218752397000046,113.23055006899986,31.21841570199999,113.230526275,31.218007625000023,113.23050485999988,31.217670932000015,113.23047154600006,31.21738182700004]";
+
+      var rs = pointsToPolygon(str);
+      console.log(rs)
+      document.write(rs);
+    }
+  </script>
+</head>
+<body>
+  
+</body>
+</html>
diff --git a/ExportMap/up.html b/ExportMap/up.html
index 13f40ff..02fddc0 100644
--- a/ExportMap/up.html
+++ b/ExportMap/up.html
@@ -21,8 +21,7 @@
     var token = "50b3fd35-7f5b-471e-974c-6240da4b3855";
 
     $(function () {
-      var flag = testArcGISServer();
-      alert(flag);
+      //var flag = testArcGISServer();
 
       $("#pathSpan").html(path);
       $("#tokenSpan").html(token);

--
Gitblit v1.9.3