7

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. enter image description here

  • Are you interested only in road network generalisation or are there some other themes/classes you on your map? – julien Sep 21 '13 at 13:30
  • Im interested mainly in roadnetwork. But I also will have rivers in the map. – MAP Sep 21 '13 at 13:38
  • By the way, isn't there a mistake in the screen-shots? The most detailed map on the right should have the bigger scale (1:10000) and the least detailed on the left the smaller, no? – julien Sep 23 '13 at 9:11
6
+25

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:

Matthias Müller and Stefan Wiemann, A framework for building multi‐representation layers from OpenStreetMap data, 15th Workshop of the ICA Commission on Generalisation and Multiple Representation, 2012

Corcoran, P.and Mooney, P. and and Winstanley A.C. Topological consistent generalization of OpenStreetMap. In Proceedings of the GIS Research UK 18th Annual Conference (London, England, 2010), M. Haklay, J. Morely, and H. Rahemtulla, Eds., University College London, pp. 149-154.

Good luck!

3

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.

  • After a long time I finaly tryed the planet_osm_roads as you said, thanks. But its not what I was looking for: I more need a topological generalisation. The OSM files have too much details I want to generalize, such as two-lane roads, serpentines, nearby passing roads and/or rivers. I need it for printing in a scale of 1:75.000, so no one interests, if the road have 8 or 4 serpentines... – MAP Sep 18 '13 at 19:42
2

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:

  1. Split linestrings
  2. Simplify linestrings
  3. Smooth linestrings

Explanations:

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
1

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.

1

There is Imposm importer. One of features are generalized tables - you decide about size of objects for generalization. And it much efficient that osm2pgsql.

1

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.

Source: http://bost.ocks.org/mike/simplify/

  • The Douglas-Peucker algorithm will simply the lines but that will cause several problems for example at crossings and wont solve problems like two-lane-roads. – MAP Sep 21 '13 at 13:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.