0

I am trying to create a symbol in MapServer. In this occasion it's a cross over a church. So I found a .png image of a black cross and include it in my symbolset.sym file:

SYMBOLSET
  SYMBOL
    NAME 'cross'
    TYPE PIXMAP
    IMAGE "cross.png"            
  END
END

and in my mapfile:

 CLASS                 
  NAME "Church"
  EXPRESSION (("[building]" IN "church,chapel"))                   
  STYLE
      COLOR 208 202 208        
      MAXSCALEDENOM 8000
  END   
  STYLE
      SYMBOL "cross" 
      SIZE 100
  END                  
END 

The effects produced are weird though. My layer includes SIZEUNITS meters so the more I zoom in, the smaller the symbol get. And apart from that the symbol is repeated inside my polygon. chapel_with_cross

How can I maintain the size of the symbol and stop the repeating effect?

1

What you see is how MapServer is using symbols with polygons - it creates a polygon fill. See examples from http://www.mapserver.org/mapfile/symbology/construction.html

For getting a single symbol for a church you have two options:

  1. Create a different point layer that contains the centroids or whatever you want to use as symbol points
  2. Use GEOMTRANSFORM http://www.mapserver.org/mapfile/geomtransform.html in your STYLE block.

For the latter I would try

 STYLE
    GEOMTRANSFORM "centroid"      
    SYMBOL "cross" 
    SIZE 100
 END             

That should work well for buildings but I am not sure about the result if the polygon in large and if client is making 256x256 tiled requests.

  • huh... second option worked well. Thank you I tried it before but I was using "bbox" instead of centroid. I can't be sure about the tiles. I am planning to use mapcache. I'll be back as soon as I set it up – Stefanos Nov 14 '17 at 13:11

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.