Appearance
KBE3D / KBCore / turf / midpoint
函数: midpoint()
Function
Takes two points and returns a point midway between them. The midpoint is calculated geodesically, meaning the curvature of the earth is taken into account.
参数
point1
first point
point2
second point
返回
a point midway between pt1 and pt2
示例
ts
const point1 = turf.point([144.834823, -37.771257]);
const point2 = turf.point([145.14244, -37.830937]);
const midpoint = turf.midpoint(point1, point2);
//addToMap
const addToMap = [point1, point2, midpoint];
midpoint.properties['marker-color'] = '#f00';