7

I am trying to use tilemill labels and Shield together for my road designing. But there is a problem with that. Please see the following image for better understanding. The shield is ovarlapping the Road name.

enter image description here

I used the following code for my .mss

#road::Labels {
      text-name: [ROAD_NAME];
      text-face-name: "Candara Bold";
      text-size: 16;
      text-fill: #000000;
      text-placement: line; 
      text-halo-fill: #f6f3f3;
      text-halo-radius: 1;
      text-spacing: 400;
      }
    #road::N_Shield {
        [ROAD_TYPE =1]{
        shield-file:  url("C:\wamp\www\shield.png");
        shield-name: [ROAD_NO];
        shield-face-name:"Arial Bold";
        shield-size:16;
        shield-fill: black;
        shield-line-spacing:5;
        shield-min-distance:1;
        shield-allow-overlap:true;
        shield-placement:line;
        shield-dx:150;
        shield-spacing:450;
        }
     }

Anyone can help me what to do.

2 Answers 2

3

You should try to vary your shield-spacing and text-spacing values. In other words make them different. This may help the placement of shields occur in a different place in the line than the text.

But a more robust solution is to use text-label-position-tolerance and shield-label-position-tolerance along with text-allow-overlap:false and shield-allow-overlap:false. This basically says to Mapnik: "Don't allow labels and shields to overlap but rather try moving them farther along the line until there is room to place them". You can see an example of this in the blog post about upcoming Mapnik features here: http://mapnik.org/news/2012/10/06/gsoc2012-status9/. In short, Mapnik 3.x will support both of these features but Mapnik 2.x only supports text-label-position-tolerance.

1
  • Much love, brother. I also used text-avoid-edges: true; which helped solve my problems. Commented Apr 20, 2018 at 0:10
2

Try to put shield-allow-overlap:false to avoid overlapping, it should solve your problem.

1
  • Probably you did not understand it. I know overlap false will banish the symbol. But I want to to all the shield and text annotation Commented Jan 30, 2013 at 9:55

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.