Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a shapefile from OSM which contains all the roads within a city. Larger roads (like dual-carriageways) seem to have 2 parallel lines. I'd like to collapse / combine those into 1 line so I can export and render them nicely in an external 3D application (2 overlapping roads will be complicated and will look weird in 3D).

How can I achieve this with either QGIS or PostGIS? I am not worried about a slight loss of accuracy (within a few metres) and would like the resulting, single line to be between (ideally the centre of) the current, parallel lines.

Thank you.

(here is an example of the dual road lines that I want to combine)

enter image description here

share|improve this question

ESRI has a collapse dual carriageway to centerline tool. You can get a cheap version for use with OSM. Otherwise you could select features and save as a new layer. Deleted selected from layer you used for export. Buffer feature within range of one side of the carriageway that includes the second lane. Merge shapefile with original, connect up any broken topology. If you can code and or script you could average a centerline between lanes on a node by seg by node matching and output a centerline programaticaly and then programaticaly deleted selected features used for the production process, check and fix broken topology, and your done.

I found a arcpy code sample I am including, how to find the link is below in comments.

attributed to ESRI ARCGis Help

# Name:
# Description: Creates street centerlines from a street casing coverage.
# Requirements: ArcInfo Workstation

# Import system modules
import arcpy
from arcpy import env

# Set environment settings
env.workspace = "C:/data"

# Set local variables
inCover = "streets"
outCover = "C:/output/centerlines"
maximumWidth = 50

# Execute CollapseDualLinesToCenterline
arcpy.CollapseDualLinesToCenterline_arc(inCover, outCover, maximumWidth, "")
share|improve this answer
could you please link to the ESRI collapse to centerline tool? I couldn't find it. The only thing I could find was the Editing dual carriageways section of this page. – Fezter Feb 13 '13 at 5:56
ArcGIS help generates uniques links that do no reference as a pated link I see, so... go to and search Collapse Dual Lines To Centerline (Coverage) the original link came from a discussion and may be wrong as you need ArcGIS for Desktop Advanced: Requires ArcInfo Workstation installed – lewis Feb 13 '13 at 18:51
Most users should not be using the "Coverage" tool (which requires Workstation), unless working with Arc7 coverage data, explicitly. Instead, use Collapse Dual Lines To Centerline (Cartography) in most cases. – RyanDalton Feb 13 '13 at 19:08

You could try using Mike Migurski's Skeletron. It's an open source tool which he uses for such things as his Terrain map style.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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