2

I have some lines I'm attempting to symbolize in Mapserver with discrete symbol at each end. Currently my .map file is set up this way:

STYLE  
  SYMBOL 0  
  WIDTH 1  
  COLOR 0 0 0  
END  

When tested the lines show up as a simple black line. I've tried appending the code below to add a symbol (defined in my .sym file) at one end of the line.

STYLE  
  SYMBOL 0  
  WIDTH 1  
  COLOR 0 0 0  
END 
STYLE
  geomtransform 'end'
  angle auto
  symbol 'bob'
  size 8
  color 0 0 0
END

This breaks my testing environment. I've also tried substituting GEOMETRYTRANSFORM in the code above with no luck. Any suggestions?

1

GEOMTRANSFORM was added in version 5.4, I suspect you are using an older version as aside from that the syntax seems correct. If that is not the case, please be more precise as to what "breaks my testing environment" actually means, e.g. by supplying at least an error message.

1

As Thomas says, make sure you have a recently new mapserver version. Then, create a file, called test.map, with the following content:

  MAP # geomtransform
    IMAGETYPE png
    EXTENT 0 0 50 55
    SIZE 250 280
    IMAGECOLOR 225 225 225

    SYMBOL
     NAME "circlef"
     TYPE ellipse
     FILLED true
     POINTS
      1 1
     END # POINTS
    END # SYMBOL

    LAYER  # start and end
     STATUS DEFAULT
     TYPE LINE
     FEATURE
      POINTS
        5 15
        25 20
        45 20
        35 15
      END # Points
     END # Feature
     CLASS
      STYLE
        GEOMTRANSFORM "start"
        SYMBOL "circlef"
        COLOR 255 0 0
        SIZE 20
      END # STYLE
      STYLE
        COLOR 0 0 0
        WIDTH 4
      END # STYLE
      STYLE
        GEOMTRANSFORM "end"
        SYMBOL "circlef"
        COLOR 0 255 0
        SIZE 20
      END # STYLE
     END # CLASS
    END # LAYER
  END # MAP

Run the command:

shp2img -m test.map -o test.png

That should produce a map with a red circle at the start point and a green circle at the end point. See also http://mapserver.org/mapfile/symbology/construction.html#tricks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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