Background
In my sample code below, the function combines a list of adjacent polygons into one. Every polygon shows its cadastral information such as cadastral community number, as well as plot number. When combining these polygons into a single convex, I want to combine the numbers into list, that is populated in the convex additional properties. The function seems to ignore the given properties though. Please observe the source code of the convex function.
I would like to open a pull request to fix this problem. I just need approval or confirmation from someone that they were able to reproduce the problem.

type AdditionalProperties = {
cadastralCommunity: string[];
plots: string[];
};
type TurfFeature = turf.Feature<turf.Polygon | turf.MultiPolygon, AdditionalProperties>;
function combinePolygons(polygons: TurfFeature[]) {
const combinedPolygons = polygons.reduce<TurfFeature>((previousPolygon, currentPolygon) => {
if (previousPolygon == null) {
return currentPolygon;
}
const reducedPlotNumbers = [...previousPolygon.properties.plots, ...currentPolygon.properties.plots];
const reducedCadastralCommunities = [
...previousPolygon.properties.cadastralCommunity,
...currentPolygon.properties.cadastralCommunity,
];
return turf.union<AdditionalProperties>(previousPolygon, currentPolygon, {
properties: {
plots: reducedPlotNumbers,
cadastralCommunity: reducedCadastralCommunities,
},
});
}, null);
if (combinedPolygons.geometry.type === 'Polygon') {
return combinedPolygons;
}
const { properties } = combinedPolygons;
const combinedConvex = turf.convex<AdditionalProperties>(combinedPolygons.geometry, {
// there's a bug in the convex function where the properties are not populated https://github.com/Turfjs/turf/blob/master/packages/turf-convex/index.ts
properties: combinedPolygons.properties
});
if (combinedConvex) {
// this should not be necessary
combinedConvex.properties = properties;
}
return combinedConvex;
}
Background
In my sample code below, the function combines a list of adjacent polygons into one. Every polygon shows its cadastral information such as cadastral community number, as well as plot number. When combining these polygons into a single convex, I want to combine the numbers into list, that is populated in the convex additional properties. The function seems to ignore the given properties though. Please observe the source code of the convex function.
I would like to open a pull request to fix this problem. I just need approval or confirmation from someone that they were able to reproduce the problem.
6.5.0
.geojson).Issue is rather simple, and doesn't need test data. Should be reproducible with any GeoJSON.
I couldn't find an issue matching this reported issue.