Merge close similar linestrings in Shapely/python

Viewed 685

Problem

I projected 3D faces to 2D lines/splines. In most of the cases my approach works, however I have an issue in one case. The spline sub-strings are looking like they are completely on top of each other. However, zooming in reveals that there are tiny distances, leading to a distorted result. I would like to merge them to a single linestring.

What I tried so far

I am working completely with shapely and standard python libraries. I am using unary_union and linemerge to clean my set of lines. I tried using shapely.ops snap but it doesnt solve the problem either. One idea has been to buffer the line strings and unite the polygons and "de"buffer afterwards. However, I did not manage to get this to work yet.

Exemplary images

Starting point Zooming Union

Question

Is there a possibility to merge those really really close linestring segments?

0 Answers
Related