Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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
add comment

2 Answers

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: CollapseDualLinesToCenterline_Example.py
# 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 resources.arcgis.com/en/help/main/10.1/index.html 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
1  
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
add comment

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
add comment

Your Answer

 
discard

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.