[GIS] Rotating PIXMAP based symbols correctly in MapServer

mapfilemapserversymbology

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?

Best Answer

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.

Related Question