diff --git a/packages/turf-center-of-mass/index.ts b/packages/turf-center-of-mass/index.ts
index d0abd8b617..61377d0d5b 100644
--- a/packages/turf-center-of-mass/index.ts
+++ b/packages/turf-center-of-mass/index.ts
@@ -1,7 +1,7 @@
import convex from '@turf/convex';
import centroid from '@turf/centroid';
import { point, Properties, AllGeoJSON, Feature, Point } from '@turf/helpers';
-import { getType } from '@turf/invariant';
+import { getType, getCoord } from '@turf/invariant';
import { coordEach } from '@turf/meta';
/**
@@ -25,7 +25,7 @@ function centerOfMass
(geojson: any, options: {
} = {}): Feature {
switch (getType(geojson)) {
case 'Point':
- return geojson;
+ return point(getCoord(geojson), options.properties);
case 'Polygon':
var coords = [];
coordEach(geojson, function (coord) {
diff --git a/packages/turf-center-of-mass/test.js b/packages/turf-center-of-mass/test.js
index 7cdda486aa..a20d9251d9 100644
--- a/packages/turf-center-of-mass/test.js
+++ b/packages/turf-center-of-mass/test.js
@@ -58,6 +58,20 @@ test('center of mass -- no area', t => {
t.end();
});
+test('center of mass -- point', t => {
+ const p = point([0, 0]);
+ const pt = centerOfMass(p);
+ t.deepEqual(pt, point([0, 0]), 'point returns pt');
+ t.end();
+});
+
+test('center of mass -- point geom', t => {
+ const geomPoint = {type: 'Point', coordinates: [0, 0]};
+ const pt = centerOfMass(geomPoint);
+ t.deepEqual(pt, point([0, 0]), 'point geom returns pt');
+ t.end();
+});
+
test('center of mass -- properties', t => {
const line = lineString([[0, 0], [1, 1]]);
const pt = centerOfMass(line, {properties: {foo: 'bar'}});