I'm trying to style a contour shapefile in TileMill with all contour lines divisible by 100 bolder than others. Can I use expressions in defining a condition? The following example of course does not work, but it gives an idea of what I am trying to get.

#contours {

  [(elev % 100 = 0)]{
    line-width: 1;
    line-color: #000;


2 Answers 2


I achieved this by creating a second shapefile which only contained the n th contour (100 in your example), but it would be preferable to style a single shapefile in the way you describe.

  • Yes, editing the shapefile is for me the fastest way to go, since there is no support in conditions. I'm actually working on shapefiles so the PostGIS solution of @James would not be too fast to implement.
    – bradypus
    Sep 10, 2014 at 16:40

TileMill doesn't support the modulus operator in expressions. So, your options are either to pre-process the shapefile, which can be annoying, or to import the data from a PostGIS database and define an 'elev%100' column on the fly.

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.