Appearance
KBE3D / KBCore / turf / transformTranslate
函数: transformTranslate()
transformTranslate<
T>(geojson:T,distance:number,direction:number,options?: {units?:Units;zTranslation?:number;mutate?:boolean; }):T
Function
Moves any geojson Feature or Geometry of a specified distance along a Rhumb Line on the provided direction angle.
Note that this moves the points of your shape individually and can therefore change the overall shape. How noticable this is depends on the distance and the used projection.
类型参数
T
T extends GeometryCollection<Geometry> | GeoJSON
参数
geojson
T
object to be translated
distance
number
length of the motion; negative values determine motion in opposite direction
direction
number
of the motion; angle from North in decimal degrees, positive clockwise
options?
Optional parameters
units?
in which distance will be expressed; Supports all valid Turf Units
zTranslation?
number
length of the vertical motion, same unit of distance
mutate?
boolean
allows GeoJSON input to be mutated (significant performance increase if true)
返回
T
the translated GeoJSON object
示例
ts
var poly = turf.polygon([[[0,29],[3.5,29],[2.5,32],[0,29]]]);
var translatedPoly = turf.transformTranslate(poly, 100, 35);
//addToMap
var addToMap = [poly, translatedPoly];
translatedPoly.properties = {stroke: '#F00', 'stroke-width': 4};