Algorithm for merging spatially close paths / line segments : <p>I am looking for (the name of) a geometric algorithm for cartographic generalization of a street map.</p>

<p>In my map data, I have many paths (ordered list of points, connected by line segments) that lay close and almost parallel to one another. How do I <strong>(1)</strong> identify these “adjacent pathsˮ (i.e. how to find paths that are closer than a certain threshold) and <strong>(2)</strong> merge them into one path (i.e. how to compute the centerline between close paths)?</p>

<p>As an example, consider the following graph of roads / lanes of roads created with data from OpenStreetMaps:</p>

<p><a href="https://i.stack.imgur.com/9pkTC.png" rel="noreferrer"><img src="https://i.stack.imgur.com/9pkTC.png" alt="Graph of a road network, consisting of three horizontal lines running across the image almost in parallel and one vertical line intersecting them in the middle"></a></p>

<p>As you can see, the two lanes of the road running horizontally are modeled as two separate paths. For detail views this is useful, but for a more zoomed out view I need to merge the two paths (lanes) to display only one line for the road.</p>

<p>What are the established algorithms used in map renderers to achieve this? Obviously, Google Maps, OSM, etc. do this -- how?</p>
