From eee3c8543668782c0af3dd43ebdf6c5338460f29 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Sat, 06 May 2023 11:19:36 +0800
Subject: [PATCH] 首页警力资源及警情信息更改

---
 src/utils/turfPolygon.js |   25 ++++++++++++++++++++++---
 1 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/src/utils/turfPolygon.js b/src/utils/turfPolygon.js
index 1ccc6ee..dc564a4 100644
--- a/src/utils/turfPolygon.js
+++ b/src/utils/turfPolygon.js
@@ -2,7 +2,7 @@
  * @Author: shuishen 1109946754@qq.com
  * @Date: 2023-03-31 10:52:25
  * @LastEditors: shuishen 1109946754@qq.com
- * @LastEditTime: 2023-04-18 20:13:04
+ * @LastEditTime: 2023-05-06 10:45:56
  * @FilePath: \srs-police-affairs\src\utils\turfPolygon.js
  * @Description: 
  * 
@@ -53,8 +53,6 @@
         return turf.centroid(turf.polygon([arr])).geometry.coordinates
     }
 }
-
-
 
 export const computerCapacity = (data, type = '') => {
 
@@ -119,4 +117,25 @@
             3
         )
     }
+}
+
+export const getMapBounds = (data, type = '') => {
+    let pointArr = []
+
+    data.forEach(item => {
+        if (item.lng && item.lat) {
+            pointArr.push(turf.point([item.lng, item.lat]))
+            return
+        }
+    })
+
+    const features = turf.featureCollection(pointArr)
+
+    console.log(turf.envelope(features))
+
+    const scope = turf.envelope(features).bbox
+
+    // const poly = turf.polygon([[[0, 29], [3.5, 29], [2.5, 32], [0, 29]]])
+
+    return scope
 }
\ No newline at end of file

--
Gitblit v1.9.3