1

I'm on mapserver 5.0.4

I want to draw a polyline with a symbol on every 100th pixel. The symbol is a PNG image with size 10 x 7 pixels. I want the symbol to be drawn perpendicular against the polyline

The class in my mapfile drawing the pattern is this:

    CLASS
        NAME 'warmfront'
        EXPRESSION ([type] == 2 )  #warmtefront
        STYLE
            SYMBOL 'warm'
        END
        STYLE
            SYMBOL 'circle' #draw a connecting line
            SIZE 2
            MINSIZE 1
            MAXSIZE 5
            COLOR 255 0 0
        END 
    END  # CLASS

The symbol "warm" is defined as:

SYMBOL
    NAME "warm"
    TYPE PIXMAP
    IMAGE 'symbols/warm.png'
    GAP -10000000000
END

The image looks now like this:

screenshot

The red triangles are now indeed drawn along the line, but the changing the GAP value doesn't seem to have any effect.


As suggested in the comments below, I changed the smbol from a picture to a vector:

SYMBOL
NAME 'warm'
TYPE VECTOR
FILLED TRUE
POINTS
  0 4
  2 0
  4 4
  0 4
END
GAP -10
END

The image now looks:

enter image description here

No symbol is drawn, or the symbol is drawn invisible


As suggested below I added a SIZE in my STYLE object:

CLASS
    NAME 'warmfront'
    EXPRESSION ([type] == 2 )  #warmtefront
    STYLE
        SYMBOL 'circle'
        SIZE 40
        MINSIZE 40
        MAXSIZE 40
        COLOR 255 0 0 
    END 
    STYLE
        SYMBOL 'warm'
        SIZE 30
        MINSIZE 30
        MAXSIZE 30
        COLOR 0 255 0
    END

END  # CLASS

and my SYMBOL def:

NAME 'warm'
TYPE VECTOR
FILLED TRUE
POINTS
  0 4
  2 0
  4 4
  0 4
END
GAP -100

The image looks now like this:

updated screenshot

But still the SYMBOL is drawn for every point on the line. When i use a pattern in my SYMBOL def like PATTERN 1 60 END the triangles do have a gap in between but they are not drawn along the direction of the line.

What do i miss?

2
  • I would strongly recommend upgrading your mapserver version, as lots of work has been done in the following 6! years concerning advanced symbology. c.f. in your case: github.com/mapserver/msautotest/blob/master/renderers/expected/… . I would also advise to not use pixmap symbols if you need to apply an arbitrary rotation. Commented Nov 12, 2013 at 12:38
  • yes i did strongly recommend, but this version is what I have to work with....
    – jorrebor
    Commented Nov 12, 2013 at 12:54

2 Answers 2

0

I have tested on 5.0.3 (could not find 5.0.4, so it might have been a developing version). The following mapfile works for me (line50.map):

MAP
  SIZE 300 75
  IMAGETYPE png24
  EXTENT 0 40 60 55
  UNITS meters

  SYMBOL
    NAME "o-flag-gap"
    TYPE pixmap
    IMAGE "o-flag.png"
    GAP 30
  END # SYMBOL

  LAYER  # Line - pixmap overlay
    STATUS DEFAULT
    TYPE LINE
    FEATURE
      POINTS
        5 45
        25 50
        55 45
      END # Points
    END # Feature
    CLASS
      STYLE
        COLOR 0 0 0
        SIZE 6
      END # STYLE
      STYLE
        COLOR 102 0 0
        SYMBOL "o-flag-gap"
        SIZE 20
      END # STYLE
    END # CLASS
  END # LAYER
END # MAP

Run:

shp2img -m line50.map -o line50.png

The result is:

mapserver output

I have been using a basic 5.0.3 configuration:

$ mapserv -v
MapServer version 5.0.3 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP OUTPUT=PDF OUTPUT=SVG SUPPORTS=FREETYPE INPUT=EPPL7 INPUT=JPEG INPUT=SHAPEFILE

The sign of GAP does not seem to have an any effect - the symbol is always oriented according to the direction of the line.

0

Simply use a negative GAP in your STYLE:

CLASS
    NAME 'warmfront'
    EXPRESSION ([type] == 2 )  #warmtefront
    STYLE
        SYMBOL 'circle' #draw a connecting line
        SIZE 2
        MINSIZE 1
        MAXSIZE 5
        COLOR 255 0 0
    END 
    STYLE
        SYMBOL 'warm'
        SIZE 10
    END
END  # CLASS

And no PATTERN in your symbol:

SYMBOL
    NAME "warm"
    TYPE pixmap
    IMAGE 'symbols/warm.png' 
    GAP -100
END

Or with a vector:

Symbol
    Name 'triangle'
    Type VECTOR
    Filled TRUE
    Points
      0 1
      .5 0
      1 1
      0 1
    END
    GAP -10
END 
7
  • Thanks for your thoughts, but the GAP keyword can only be put within the SYMBOL object. Following your solution I get a parsing error: Warning: [MapServer Error]: loadStyle(): Parsing error near (GAP):(line 91) in /path/to/mapfile/
    – jorrebor
    Commented Nov 12, 2013 at 8:18
  • Sorry this was for 6.x. Since you are using 5.0.4, you need to put the GAP in the symbol. I edited my answer to reflect that. Commented Nov 12, 2013 at 14:49
  • Sorry for my late reply, see my original question for an update
    – jorrebor
    Commented Nov 14, 2013 at 11:22
  • Can you test with a vector symbol instead of a pixmap? You are using a triangle anyway and the rotation of a pixmap symbol will always give you a very ugly result. See my answer for a vector triangle Commented Nov 14, 2013 at 20:36
  • I did, see my question, no luck....
    – jorrebor
    Commented Nov 15, 2013 at 15:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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