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

center

Quick answer

Takes a Feature or FeatureCollection and returns the absolute center point of all features.

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

Description​

Takes a Feature or FeatureCollection and returns the absolute center point of all features.

Parameters​

NameTypeDescription
geojsonGeoJSONGeoJSON to be centered
options?ObjectOptional parameters (default {})
options.properties?ObjectTranslate GeoJSON Properties to Point (default {})
options.bbox?ObjectTranslate GeoJSON BBox to Point (default {})
options.id?ObjectTranslate GeoJSON Id to Point (default {})

Returns​

Feature<Point> a Point feature at the absolute center point of all input features

Examples​

var features = turf.points([
[-97.522259, 35.4691],
[-97.502754, 35.463455],
[-97.508269, 35.463245],
]);

var center = turf.center(features);

Installation​

$ npm install @turf/center

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

import * as turf from "@turf/turf";
const result = turf.center(...);
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/center · Chinese note: /turf/api/center.html
Cite this page

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