5

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?

6

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; }
  }

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.