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.

Suppose you have a mapfile containing a background layer and a layer with a lot of overlapping linestrings.

Now, for the overlapping linestrings, it might be good to visualize their density, thus at places where a lot of lines do overlap they might be drawn more "solid" than at places where only a few lines are present.

Using QGIS, for example, I can do this by just turning the layer opacity to some small value (say five percent). In Mapserver, however, setting the opacity of the layer, the opacity will just make the whole layer see through, but will not add up for each single element.

How can I archive the desired effect?

share|improve this question
    
Is the linestrings layer a POINT or a LINE kind of layer? If it's a POINT or it can be converted into a POINT layer then it might be worthwhile checking out the new CLUSTER feature: mapserver.org/mapfile/cluster.html#cluster –  unicoletti Oct 18 '11 at 7:54
    
Thanks for the suggestion. However, the lines should remain as lines - this is set by the application. –  Thilo Oct 18 '11 at 11:02
add comment

2 Answers

up vote 5 down vote accepted

In Mapserver you can either set the OPACITY at the LAYER level or for each individual STYLE. A layer can have multiple styles for each of the different line types. This method relies on you being able to split your linestrings into different classes based on an attribute (such as year in the example below).

LAYER
CLASSITEM "year"
...
CLASS
  NAME "Lines"
  EXPRESSION "2010"
  STYLE
    OPACITY 70
    COLOR 178 114 1
    SIZE 15
  END # STYLE
END # CLASS
CLASS
  NAME "More Lines"
  EXPRESSION "2011"
  STYLE
    OPACITY 70
    COLOR 178 114 1
    SIZE 15
  END # STYLE
END # CLASS
END

If you just want one style, the solution is even simpler:

LAYER
...
CLASS
    NAME "Lines"
    STYLE
        OPACITY 5
        COLOR 178 114 1
        SIZE 15
    END # STYLE
END # CLASS
END
share|improve this answer
    
Thanks. While I have no attribute to cluster, your suggestion did the trick. You simply can use only one class without the expressions. –  Thilo Oct 18 '11 at 11:05
    
I edited your answer to accomodate the simple solution. –  Thilo Oct 18 '11 at 11:08
add comment

I'm not sure if MapServer implements this but SLD allows you to specify the opacity of the line itself in the styling. This is different than the layer transparency setting which as you say just makes the background see through.

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.