Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Is it possible to do something like this:

#ways[highway="trunk"] {
  line-color:#c99;
  line-width:@zoom/10;
}

Obviously that example doesn't work. Is there another way to do arithmetic expressions involving the zoom level?

share|improve this question
add comment

1 Answer 1

up vote 5 down vote accepted

You can't use zoom as a variable at the moment as you mentioned. I've read this is planned (and I'm excited to see it implemented too).

Here's one work-around, etc:

  #ways[highway="trunk"] {
  line-color: #c99; 
  [zoom=10] { line-width: 1; }
  [zoom=11] { line-width: 1.1; }
  [zoom=12] { line-width: 1.2; }

If you have multiple highway types, you could also do:

@z10base=10;
@z11base=11;

  #ways[highway=trunk"] {
  line-color: #c99; 
  [zoom=10] { line-width: @z10base; }
  [zoom=11] { line-width: @z11base; }
  }

 #ways[highway="primary"] {
  line-color: #000000; 
  [zoom=10] { line-width: @z10base + 4; }
  [zoom=11] { line-width: @z11base + 8; }
  }
share|improve this answer
add comment

Your Answer

 
discard

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.