12345678910111213 |
- import * as turf from '@turf/turf';
- import BigNumber from 'bignumber.js';
- export function countRectangleArea(path, decimal = 4) {
- const polygon = turf.polygon(path);
- return new BigNumber(turf.area(polygon)).dp(decimal).toNumber();
- }
- export function countCircleArea(center, radius, decimal = 4, options = { steps: 64, units: 'meters' }) {
- // 创建圆形
- const circle = turf.circle(center, radius, options);
- return new BigNumber(turf.area(circle)).dp(decimal).toNumber();
- }
|