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 am making a map containing information about public transportation: busses, trams, etc. The map will have a layer containing for example the tram lines. Each line has its own colour, and is represented by a line string geometry.

The problem is, many of the lines have overlapping parts, where more than one tram line cover the same section. To show this to the user, I'd rather want the lines to run parallel to each other instead of being drawn on top of each other. For an example, see how Google Maps show the New York subway lines.

I suspect this is a quite common problem in cartography, but don't know what terminology I should search for.

I am using PostGIS/GeoServer/OpenLayers as my stack, but any open source solution would be acceptable.

share|improve this question
    
Having the same issue with subway-lines. Have you found/implemented an acceptable solution? –  Geert-Jan Dec 12 '12 at 11:49
    
Unfortunately, no. The customer did not prioritize this, and we did a quite nasty hack to prevent overlapping. –  Liedman Dec 19 '12 at 15:06

5 Answers 5

If you're interested in learning more about this area, the problem is named cartographic displacement, and its one aspect of cartographic generalization.

A couple of articles discussing displacement and approaches for handling the problem:

share|improve this answer
    
"Displacement"! That was the other term I was trying to remember. We have a tool in FME (sorry - not open source) that "Solves proximity conflicts between features using a variant of the Nickerson displacement algorithm" - so perhaps do a Google of Nickerson to see what comes up? –  Mark Ireland Aug 26 '10 at 17:18
    
scholar.google.com/… throws up a link to the original article (sadly pay walled) and a lot of people referencing it. Some of the related articles are free and look interesting. –  iant Aug 26 '10 at 17:26

This problem is a very typical one in cartographic generalisation. Automated methods exist for that, but no implementations are available yet.

Methods based on "Beams" and "Snakes" give efficient results to solve these cartographic conflicts of network data (see also the references given by scw). Here are some results of the beams algorithms on road data:

Before:

alt text

After:

alt text

See also this paper and this presentation that explain how to do this transformation.

EDIT: I have never tested it, but it seems there is something related to snakes in GRASS. See here.

share|improve this answer
1  
Does this work if two line segments (bus tracks) have the exactly same geometry? –  underdark Aug 31 '10 at 10:15
1  
It applies for too closed lines, and should not work so well for lines that exactly overlap. An adaptation is needed. –  julien Aug 31 '10 at 11:29

I don't know of a solution, but I think the term you are looking for is "conflict resolution" - a topic of map generalization. A Google search on "map generalization conflicts" shows some interesting info - but I don't know there's much of practical use.

share|improve this answer

If you are drawing line layers that overlap, you have several options to allow the viewer to see all of the lines.

  1. Width - you vary the line width between layers and put the wider lines on the bottom.
  2. Opacity/Transparency - you can make individual line layers partially opaque, so you can 'see through' individual layers.
  3. Offset - you can offset the line symbol representing the actual line feature to one side of the actual geometry of the line. Individual layers can be offset by different amounts and in different directions to allow all layers to be seen.
  4. Lines can be represented by a series of point symbols with a defined gap between the symbols. By varying the symbol, symbol color, symbol size, and gap between the different line layers, you should make each individual line layer distinguishable.

I don't use GeoServer, but I know that MapServer has the functionality to do all of these things. It is likely that GeoServer does as well.

share|improve this answer
    
It sounds like we want #3, but only for overlapping features. Is that possible? –  mwalker Aug 26 '10 at 16:06
2  
MapServer and other web map servers and GIS do conflict resolution for labels, but I am not aware of a feature that would allow you to do this on the fly. Of course, if your data was fairly static, you could pre-process your data to identify where lines from different layers intersect (or are within a tolerance) and classify the data based on this. Your map rendering engine could then apply the 'displacement' symbology based on an attribute in your data. –  DavidF Aug 26 '10 at 17:50

In current implementations, you can often find either "Offset" or "Dislocation". Using you're current stack, it looks a bit difficult to achieve parallel lines automatically:

To sum it up: The easiest way I know of would be to use UMN Mapserver and the Offset value there. Example style for your mapfile:

STYLE
 SYMBOL 7
 OUTLINECOLOR 160 160 160
 SIZE 5
 OFFSET 2 -99 # <-- This will offset the line to the right.
 ANTIALIAS FALSE
END # STYLE
share|improve this answer

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.