shuishen
2023-05-06 eee3c8543668782c0af3dd43ebdf6c5338460f29
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
}