Atlaslog
Atlaslog / Turf.js / API / midpoint
Turf.js · API reference

midpoint

Quick answer

Takes two points and returns a point midway between them. The midpoint is calculated geodesically, meaning the curvature of the earth is taken into acco.

Last verified 2026-11-03 · Turf.js 7.x · Cite this page
Runnable examplesChinese noteAll API topics

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​

Feature<Point> a point midway between pt1 and pt2

Examples​

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

const 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(...);
TutorialsAPI index
English reference text adapted from the official Turf.js documentation, © Turf.js contributors, licensed under MIT.
Original page: https://turfjs.org/docs/api/midpoint · Chinese note: /turf/api/midpoint.html
Cite this page

Atlaslog (2026). midpoint. https://www.jingweizhi.com/en/turf/api/midpoint.html (accessed 2026-11-03).