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/package.json b/packages/turf-convex/package.json
index 0471d0207..9ebb5868a 100644
--- a/packages/turf-convex/package.json
+++ b/packages/turf-convex/package.json
@@ -3,6 +3,10 @@
"version": "7.3.1",
"description": "Creates a convex hull around points",
"author": "Turf Authors",
+ "contributors": [
+ "Brock Chelle <@blchelle>",
+ "Kareem Jeiroudi <@kareemjeiroudi>"
+ ],
"license": "MIT",
"bugs": {
"url": "https://github.com/Turfjs/turf/issues"
diff --git a/packages/turf-convex/test.ts b/packages/turf-convex/test.ts
index 58b0cde7c..51c98ffcb 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 { type 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 transferred to result polygon", (t) => {
+ const geoJson = loadJsonFileSync