| | |
| | | * @Author: shuishen 1109946754@qq.com |
| | | * @Date: 2023-03-31 10:52:25 |
| | | * @LastEditors: shuishen 1109946754@qq.com |
| | | * @LastEditTime: 2023-05-06 16:52:41 |
| | | * @LastEditTime: 2023-05-08 18:21:01 |
| | | * @FilePath: \srs-police-affairs\src\utils\turfPolygon.js |
| | | * @Description: |
| | | * |
| | |
| | | |
| | | } |
| | | } else { |
| | | console.log(data, 564) |
| | | let pointArr = [] |
| | | data.forEach(item => { |
| | | if (item.longitude && item.latitude) { |
| | |
| | | |
| | | // const poly = turf.polygon([[[0, 29], [3.5, 29], [2.5, 32], [0, 29]]]) |
| | | |
| | | global.viewer.flyToBounds(scope, |
| | | { heading: 0, pitch: -45, roll: 0 }, |
| | | console.log([[scope[0], scope[1]], [scope[2], scope[1]], [scope[2], scope[3]], [scope[0], scope[3]]]) |
| | | |
| | | var poly = turf.polygon([[[scope[0], scope[1]], [scope[2], scope[1]], [scope[2], scope[3]], [scope[0], scope[3]], [scope[0], scope[1]]]]) |
| | | var scaledPoly = turf.transformScale(poly, 4) |
| | | |
| | | let boxPoint = [] |
| | | scaledPoly.geometry.coordinates[0].forEach(item => { |
| | | boxPoint.push(turf.point(item)) |
| | | }) |
| | | |
| | | const boxFeatures = turf.featureCollection(boxPoint) |
| | | |
| | | const boxScope = turf.envelope(boxFeatures).bbox |
| | | |
| | | global.viewer.flyToBounds(boxScope, |
| | | { heading: 0, pitch: -90, roll: 0 }, |
| | | (e) => { }, |
| | | 3 |
| | | ) |