3

How can I more efficiently write this piece of code which aims to style two features in my streets layer (major roads and major road ramps) the exact same way.

#tor_centreline [FCODE=201200] {
      line-width: 0.5;
      line-color: lightgray;
   }

#tor_centreline [FCODE=201201] {
      line-width: 0.5;
      line-color: lightgray;
   }

When I input the code as...

#tor_centreline [FCODE=201200],[FCODE=201201] {

... I break my map because I believe the second [FCODE=""] is not linked to the #tor_centreline... such that it searches all of my layers for [FCODE=""] and when it finds a layer with no "FCODE" attribute field I receive an error.

2 Answers 2

6

(Cross-posting from GitHub for the benefit of StackExchangers..)

Both filters must be connected to a layer selector. There are two options that require only specifying the style once:

#tor_centreline [FCODE=201200],
#tor_centreline [FCODE=201201] {
  line-width: 0.5;
  line-color: lightgray;
}

or

#tor_centreline {
  [FCODE=201200],
  [FCODE=201201] {
    line-width: 0.5;
    line-color: lightgray;
  }
}
2
#tor_centreline {
    [FCODE=201200] {line-width: 0.5; line-color: lightgray;}
    [FCODE=201201] {line-width: 0.5; line-color: lightgray;}
}

see: http://support.mapbox.com/kb/tilemill/styling-point-data-using-tilemill

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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