My main goal is to combine linestrings into a polygon. The problem is that concatenating the linestrings does not produce valid polygons. The used library Turf.js does not provide clear answer.
Building the concave hull of the points also does not produce a valid polygon.
Background:
I had to split polygons into linestrings of two kinds: line intersections and outerlines of the polygon, so that i can simplify each individual line, and then concatenate the lines to form a simplified polygon. The individual linestrings are almost the same as the initial polygons, but concatenating them again to a valid polygon seems to be the harder part.
//array of linestrings
feature_array = feature_array.map(feature => feature.geometry.coordinates)
// converting each array element to a line string
feature_array = feature_array.map(line => turf.lineString(line))
var feature_collection = turf.featureCollection(feature_array)
var polygon = turf.lineToPolygon(feature_collection)
Initial Test - Linestrings: displaying individual linestrings
Concatenating Test: trying to combine them into polygon