diff --git a/packages/turf-convex/index.ts b/packages/turf-convex/index.ts index d7969ec59..9a59a9893 100644 --- a/packages/turf-convex/index.ts +++ b/packages/turf-convex/index.ts @@ -56,7 +56,7 @@ function convex
( // Convex hull should have at least 3 different vertices in order to create a valid polygon if (convexHull.length > 3) { - return polygon([convexHull]); + return polygon
([convexHull], options.properties);
}
return null;
}
diff --git a/packages/turf-convex/test.ts b/packages/turf-convex/test.ts
index 58b0cde7c..559362c00 100644
--- a/packages/turf-convex/test.ts
+++ b/packages/turf-convex/test.ts
@@ -6,6 +6,7 @@ import { writeJsonFileSync } from "write-json-file";
import { loadJsonFileSync } from "load-json-file";
import { featureCollection } from "@turf/helpers";
import { convex } from "./index.js";
+import { FeatureCollection } from "geojson";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
@@ -32,3 +33,17 @@ test("turf-convex -- empty", (t) => {
t.deepEqual(convex(featureCollection([])), null, "corner case: null hull");
t.end();
});
+
+test("turf-convex -- properties are returned", (t) => {
+ const geoJson = loadJsonFileSync