turf 的 mask() 函数不会 运行 包含 10 个或更多多边形
turf's mask() function does not run with 10 or more polygons
我不能 运行 turf.mask()
函数有超过 9 个随机创建的点。它只是没有 return 任何结果。
import { featureCollection, polygon } from '@turf/helpers';
import createCircle from '@turf/circle';
import createMask from '@turf/mask';
const howManyCircles = 9;
const cover = polygon([
[[-180, -90], [180, -90], [180, 90], [-180, 90], [-180, -90]]
],
{ name: 'cover' });
const bbox = [83.16964204361335,83.47466091885153,-83.16964204362385,-83.47466091885192];
const randomPoints = randomPoint(howManyCircles, { bbox: bbox });
const radius = 1000;
const options = { steps: 64, units: 'kilometers', properties: { foo: 'bar' } };
const circles = randomPoints.features.map(points => {
return createCircle(points.geometry.coordinates, radius, options);
});
const mask = createMask(featureCollection(circles), cover);
这按预期工作。多边形中有九个孔(通过 randomPoints()
函数创建)。
但是,一旦我将 howManyCircles
更改为大于 9
的数字,我就没有得到任何结果。它计算并计算但没有结束。这里有一个 fiddle 可以玩:https://jsfiddle.net/6m3qsnu1/
这是为什么?
"@turf/helpers": "^6.3.0",
"@turf/random": "^6.3.0",
"@turf/turf": "^6.3.0",
显然这是一个已知错误,已在 v7
中修复。但是,yarn add @turf/turf
或 npm i @turf/turf
安装 turf 6.3.0
。要安装最新版本,请使用 npm i turf@7.0.0-alpha.1
我不能 运行 turf.mask()
函数有超过 9 个随机创建的点。它只是没有 return 任何结果。
import { featureCollection, polygon } from '@turf/helpers';
import createCircle from '@turf/circle';
import createMask from '@turf/mask';
const howManyCircles = 9;
const cover = polygon([
[[-180, -90], [180, -90], [180, 90], [-180, 90], [-180, -90]]
],
{ name: 'cover' });
const bbox = [83.16964204361335,83.47466091885153,-83.16964204362385,-83.47466091885192];
const randomPoints = randomPoint(howManyCircles, { bbox: bbox });
const radius = 1000;
const options = { steps: 64, units: 'kilometers', properties: { foo: 'bar' } };
const circles = randomPoints.features.map(points => {
return createCircle(points.geometry.coordinates, radius, options);
});
const mask = createMask(featureCollection(circles), cover);
这按预期工作。多边形中有九个孔(通过 randomPoints()
函数创建)。
但是,一旦我将 howManyCircles
更改为大于 9
的数字,我就没有得到任何结果。它计算并计算但没有结束。这里有一个 fiddle 可以玩:https://jsfiddle.net/6m3qsnu1/
这是为什么?
"@turf/helpers": "^6.3.0", "@turf/random": "^6.3.0", "@turf/turf": "^6.3.0",
显然这是一个已知错误,已在 v7
中修复。但是,yarn add @turf/turf
或 npm i @turf/turf
安装 turf 6.3.0
。要安装最新版本,请使用 npm i turf@7.0.0-alpha.1