Is there a tool or algorithm to (topological) generalizes OSM-shapes? I would like to build a printable map in different scales.
In the image below you can see the same divided road (yellow) at different scales.

Is there a tool or algorithm to (topological) generalizes OSM-shapes? I would like to build a printable map in different scales.
In the image below you can see the same divided road (yellow) at different scales.

A quick and dirty solution would be to simply apply a Ramer-Douglas-Peucker filter to the road sections. Note that there are variations of the algorithm preserving topology: See for example here and there,with rivers.
If you aim at developing more advanced generalisation for a better cartographic result, I am afraid no such tool exists (yet) in GRASS and QGIS. You do not only need to simplify the road sections individually but the network as a whole by deleting/selecting some road sections (see references given there). You could also have a look at this other question listing different solutions for automated generalisation. This website lists current progresses in the field. There are especially these two papers describing generalisation procedures for OSM data:
Good luck!
The osm2pgsql importer for postgis does this generalizing: The table planet_osm_roads is designed for low zoomlevels, while planet_osm_line contains the complete geometry.
See also http://wiki.openstreetmap.org/wiki/Osm2pgsql/schema#Processed_Data
It works with OSM raw data in xml format, not shapefiles. You can get all kinds of regional extracts from Geofabrik.
Exporting planet_osm_roads from Postgis to a shapefile should be easy with QGIS.
Automated cartographic generalization is a research issue since 20 years. You will have to accept artifacts in the output as computers don't yet have human skills.
I'm working on it (no promises though) with the following approach using PostGIS:
Explanations:
To split linestrings at common intersections use ST_Split (or ST_Union); requires PostGIS 2.x.
To simplify linestrings use ST_SimplifyPreserveTopology(), which implements Douglas-Peuker algorithm.
Smoothing linestrings: This is an open issue (too) in PostGIS and other GIS tools, as stated in the book "PostGIS in Action" in chapter 2.2.6 "Curved geometries". One could use bezier/spline curve which fit to original linestring points. See also How to perform SIA or Bezier line smoothing in PostGIS?
This approach will not work e.g. if road topology is erroneous, and will not do linestring merging (as needed for multi-line-roads).
Example (Note: MyST_SmoothLine() still needs to be implemented):
SELECT
MyST_SmoothLine( -- smooth lines
ST_SimplifyPreserveTopology( -- simplify lines
ST_Dump( ST_Split(s.the_geom, u.the_geom)), -- split lines
0.1),
1)
FROM osm_roads AS s, osm_roads AS u
To simplify geometry to suit the displayed resolution, various line simplification algorithms exist. While Douglas–Peucker is the most well-known, Visvalingam’s algorithm may be more effective and has a remarkably intuitive explanation: it progressively removes points with the least-perceptible change.
Not sure if it helps, but I've implemented my own tool(s) for generalizing of OSM road networks for vector maps on ScalableMaps site. It uses Visvalingam’s algorithm (I used Douglass-Peucker initially, but Visvalingam produces better-looking results) and runs the simiplification based on the road network topology (it preserves road crossing nodes). What it doesn't yet do is joining of two-way lanes, that's a harder problem to solve (especially when it comes to cloverleafs). There's an open-source project called Skeletron (and a generalized OSM roads dataset) done by Michal Migurski that you should check out.
There's also an interesting article called "Morphing Polylines: A Step Towards Continuous Generalization" that tries to address the problem of generalization of serpentines.
There is Imposm importer. One of features are generalized tables - you decide about size of objects for generalization. And it much efficient that osm2pgsql.