Skip to main content
Version: 6.5.0

midpoint

Description

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.

Parameters

NameTypeDescription
point1Coordfirst point
point2Coordsecond point

Returns

Examples

var point1 = turf.point([144.834823, -37.771257]);
var point2 = turf.point([145.14244, -37.830937]);

var midpoint = turf.midpoint(point1, point2);

Installation

$ npm install @turf/midpoint

import { midpoint } from "@turf/midpoint";
const result = midpoint(...);
$ npm install @turf/turf

import * as turf from "@turf/turf";
const result = turf.midpoint(...);