Pages

Thursday, February 24, 2011

Creation of the complicated notation conventions in QGIS: a river lock

New symbology in QGIS allow to create sophisticated convenient notation. And it will be more powerful in future QGIS version 1.7.

Here some approaches to symbols creation will be demonstrated with the specific example. You can see an example of the very difficult symbol to create - a river lock:


"Lock" symbol
It might be difficult to believe that it is possible to create symbol like this, but the proof is right here. That's how it looks like after export from  the Print Composer:

Symbol "lock" in QGIS (river is in another layer).

How to create such beauty?


There are two main issues: bended edges of the lines and a triangle which is cutting symbol in the middle. First of all it is necessary to decide how to deal with the triangle - the most complicated part of the symbol. It has to have fill and one of its edges transparent. Let's use the logic: lock  symbol is always above the river polygon, so the fill of the triangle doesn't have to be transparent, it may have a colour of the river instead! As to the bended edges, there are suitable marker for its imitation among standard markers.

Let's begin. Go to "Settings" → "Stile manager" → "Line" → "Add". We will need 6 lines: 4 marker lines (all markers needed are already there by default) and 2 simple lines. To add lines just click on the "+" button under "Symbol layers" window. So we have 6 symbol layers (from top to the bottom):

  1. Marker line - triangle the same colour as the water to mask the bottom edge of the triangle in the layer below. 
  2. Marker line - triangle with the black edges and fill of the same colour as water.
  3. Simple line white.
  4. Simple line black.
  5. Marker line - closing marker (rotated tick).
  6. Marker line - opening marker (rotated tick).
Settings for each symbol layer are presented below. For the purposes of reducing number of images settings "Symbol layer properties" and "Symbol properties" are shown at the same picture (marker lines only).

Let's start with the analysis of the lowest layer of our conventional sign, and will move to the top layer by layer - so it will be easier to explain.
At the bottom (symbol layer #6) an opening marker is located:
  • Highlight the lowest line in "Symbol layers", then go to "Symbol layer type" field and pick up "Marker line" (options "Simple line", "Marker line" and "Line decoration" are available). A black default line became a line of red circle.
  • In "Symbol layer properties" choose "on first vertex only".
  • Now hit "Change". A "Symbol properties" dialogue will appear.
  • Choose a tick marker.
  • Define "Border color" as black (it is already black by default).
  • "Size" - 2,0 (already by default).
  • "Angle" - 0,0 (already by default).
  • "Offset X") - 0,2 (define yourself).
The purpose of the "Offset X" in this case is to emulate bending edges: and its value must be defined the way it will allow a tick's "wings" to be extensions of the thin black lines. NB: in "Symbol preview" window in general "Symbol proreties" window edges of the line are cut, so you have to set "Offset X" value blindly and change it after testing  with actual line.

That's how settings for the symbol layer #6 looks like:

Opening marker settings (layer #6).

Do the same with the closing marker, except you must "on last vertex only" at the "layer properties", and set "Angle" value 180,00 at marker settings. Here you are these settings:

Closing marker settings (symbol layer #5).
Let's place two simple line layers above opening and closing markers. To  achieve an effect  of framing the white line with two black lines we'll make black line wider and white line (above black one) thinner. Line width is defined with the "Pen width" option. Black line (symbol layer #4) settings are at the picture below. NB:  "Flat" "Cap style" was chosen, an explanation will be given later.
Black simple line settings (symbol layer #4).
Now let's place thin white line above the black one (symbol layer #3). Pick the "Square" cap style for it. See the settings:

White line settings (symbol layer #3).
One quite sophisticated nuance was used here. NB: in new symbology line isn't cut at the last (first) vertex - there is a very small "cap", and there are three types of it:  square, flat and round. "Flat" one is the shortest one. A shorter type of cap was used for black simple line below and longer type was used for the black simple line above to prevent the black one from framing white one at flanks. Here is an example for our symbol with  the square capes for the black line (symbol layer #4):

Square caps for the symbol layer #4 were chosen.
Now we have to cut a triangle in the middle of our symbol. We'll need 2 almost the same marker layers. Lower one for triangle "cut" and higher one to mask the bottom edge of the  lower triangle. Settings for the lower layer (symbol layer #2) are at the picture below.  Marker placement is "on central point", "Line offset" = "-0,30" (lower edge of the triangle must be at the same level as lower framing black line). Border colour for the triangle - black, and the colour for triangle fill is colour used for water (in my case it is the colour used for water symbols in the notation conventions project).

Marker line settings (layer #2).
Finally, for the top marker line (symbol layer #1) we  place marker on the central point. At this time border and fill colours are the same; triangle is slightly smaller (to prevent  complete overlapping with the lower one and to be at he same level as the framing black line); the offset is not set, so central point of this triangle is lower than central point of the one below:

Marker line settings (symbol layer #1).

All we need to now is to save this style, apply it to some test line and correct  markers in layers #5 and #6 if needed.

The power of new symbology of QGIS was demonstrated with this example. Methods described in the post allow creation of a very sophisticated  and beautiful symbols for your projects.

No comments:

Post a Comment