# transformRotate

Rotates any geojson Feature or Geometry of a specified angle, around its centroid or a given pivot point; all rotations follow the right-hand rule: https://en.wikipedia.org/wiki/Right-hand_rule


参数 类型 描述
geojson GeoJSON object to be rotated
angle number of rotation (along the vertical axis), from North in decimal degrees, negative clockwise
options Object Optional parameters: see below


属性 类型 默认值 描述
pivot Coord centroid point around which the rotation will be performed
mutate boolean false allows GeoJSON input to be mutated (significant performance increase if true)


GeoJSON - the rotated GeoJSON feature


var poly = turf.polygon([[[0,29],[3.5,29],[2.5,32],[0,29]]]);
var options = {pivot: [0, 25]};
var rotatedPoly = turf.transformRotate(poly, 10, options);
Last Updated: 1/19/2021, 10:59:20 AM