Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm working with mapfile. I defined new layer "contours" and I want to render with maxscale = 100000 and minscale = 50000 contours with value distance of 50. That means that I want in that scale render only those countours with values of "height" attribute of 0, 50, 100, 150, 200, 250, 300, 350.. etc.

 NAME "contours"
 TYPE line
 DATA "contours.shp"

 NAME "all_contours"
     COLOR 176 226 255

  #Is this CLASS I started creating correct? 

       NAME "main_contours"
       MAXSCALE 99000
       MINSCALE 50000
       EXPRESSION #this is my question

share|improve this question
What version of MapServer are you using? – geographika Jun 9 '11 at 21:18
I'm using MapServer 6.0. – againstflow Jun 9 '11 at 23:58
up vote 3 down vote accepted

That should work using modulo:

EXPRESSION ( ([height] % 50) = 0 )
share|improve this answer
+1. Very clever solution. Also note the MAXSCALE and MINSCALE keyworks have been deprecated so use the MAXSCALEDENOM and MINSCALEDENOM instead. – geographika Jun 10 '11 at 7:40
Thank you. If I'm using older version of Mapserver, can I use the same expression or something different? – againstflow Jun 10 '11 at 12:12
Seems like MapServer 5 had a bug related to the modulo operator:… - so it depends on if it has been fixed in your version. – underdark Jun 10 '11 at 12:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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