booleanClockwise
函数用于判断线性环是否按逆时针方向排列。可以用于进行多边形面积计算时的判断。
turf.booleanClockwise(linearRing)
linearRing
:类型为 Feature<LineString>
或 Feature<Polygon>
,表示线性环或多边形。Boolean
。true
;否则返回 false
。const linearRing = turf.lineString([
[-77.037076, 38.884017],
[-77.025859, 38.885821],
[-77.021339, 38.889563],
[-77.019704, 38.893223],
[-77.022556, 38.895767],
[-77.027168, 38.897088],
[-77.036556, 38.896568],
[-77.044309, 38.893767],
[-77.049839, 38.889440],
[-77.049294, 38.885626],
[-77.043674, 38.882202],
[-77.037076, 38.884017]
]);
const isClockwise = turf.booleanClockwise(linearRing);
console.log(isClockwise); // false