My problem is as follows: I have some lines (yellow), that I want to merge in one line if they are at a certain distance (blue, buffer), and after a long research I found this function from PostGIS/SFCGAL. The output are the red lines. It kinda does the job, but it makes a strange angle when it joins the lines that I would like to get rid off. The function does not have parameters to tweak, so I wonder what else I could do. I do not want the skeleton, which I could find some help here, cause I dont want the line to be touching the borders of the buffer.