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.

Please see the following Image. enter image description here I am using a single feature layer for road. Now I using the following code

    #roads {
  [ROAD_TYPE = 1] {line-width:8; line-color:#194536;}
  [ROAD_TYPE = 2] {line-width:8; line-color:#456321;}
  [ROAD_TYPE = 3] {line-width:8; line-color:#785632;}
  [ROAD_TYPE = 4] {line-width:8; line-color:#236485;}
  [ROAD_TYPE = 5] {line-width:8; line-color:#FFFFFF;}
  [ROAD_TYPE = 6] {line-width:8; line-color:#194536;}
  line-join: round;
  line-cap: round;
  line-smooth: 0.1;
  }

The problem is in the Black circles the white goes under the green road layer. But in the red circle the white layer overlap the green and other major layers. How can I solve it and make it a very nice style as Google or OSM map?

share|improve this question
    
Can you post the rest of your CSS, including your attempt to use symbolizers? Just noticed there must be more code since the roads in your example image have casings. –  Scro Dec 24 '12 at 12:57
    
No, I think....there is only one layer with light green background. –  Devils Dream Dec 24 '12 at 15:26
add comment

3 Answers 3

up vote 3 down vote accepted

Draw order is determined by order of 'symbolizers', whitch are rendered in the order that they are encountered in your CartoCSS. If your example is in the right order, then it could be done like this:

#roads {
::roadtype1 {
  [ROAD_TYPE = 1] {line-width:8; line-color:#194536;}
}
::roadtype2 {
  [ROAD_TYPE = 2] {line-width:8; line-color:#456321;}
}
::roadtype3 {
  [ROAD_TYPE = 3] {line-width:8; line-color:#785632;}
}
::roadtype4 {
  [ROAD_TYPE = 4] {line-width:8; line-color:#236485;}
}
...
}

I don't remember, but I think you will have to put your attributes (line-cap, etc.) in each symbolizer.

share|improve this answer
    
Thank you for your suggestion but unfortunately not worked. –  Devils Dream Dec 23 '12 at 10:28
add comment

The order in which your road_types are written in carto affect the order they are drawn. I'm not 100% sure, but I'm pretty positive that the top ones are drawn first and subsequent ones are drawn later, meaning they are drawn over the ones that already exist.

However, this understanding doesn't match your picture and your rules. Are you certain those rules were saved before You need to save your styling, by clicking save in the right hand corner of tilemill, to display any changes that you made with the carto code.

If you want brown on top of everything, you should instead do:

  #roads {
  [ROAD_TYPE = 5] {line-width:8; line-color:#FFFFFF;}
  [ROAD_TYPE = 1] {line-width:8; line-color:#194536;}
  [ROAD_TYPE = 6] {line-width:8; line-color:#194536;}
  [ROAD_TYPE = 4] {line-width:8; line-color:#236485;}
  [ROAD_TYPE = 2] {line-width:8; line-color:#456321;}
  [ROAD_TYPE = 3] {line-width:8; line-color:#785632;}
  line-join: round;
  line-cap: round;
  line-smooth: 0.1;
  }
share|improve this answer
    
Thank you for your suggestion but unfortunately not worked. –  Devils Dream Dec 23 '12 at 10:28
add comment

Just came across this as I was searching for an answer to a similar question.

If none of the above work, you could try the somewhat awkward approach of splitting the layer into two separate layers in Arc or qGIS, import both into TileMill, and make sure that the layer with white roads [Road_Type = 6] is below the other layer in the list of layers. That will ensure that all white roads are below the other road types.

I'm surprised Scro's answer didn't work, though. To be clear, to make [Road_Type = 6] display under the other roads using his method, the carto code would look something like:

#roads {
::roadtype6 {
  [ROAD_TYPE = 6] {line-width:8; line-color:#FFFFFF;}
}
::roadtype2 {
  [ROAD_TYPE = 2] {line-width:8; line-color:#456321;}
}
::roadtype3 {
  [ROAD_TYPE = 3] {line-width:8; line-color:#785632;}
} etc.

with the selector containing [ROAD_TYPE = 6] appearing as the first selector in the layer.

Hope this helps.

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.