labelling problem in Tilemill 0.9

perikut's Avatar

perikut

22 Feb, 2012 11:43 AM

hi all,

I'm struggling with a 'simple' label problem.

If you see in this image you will fast notice that 'Cambodge' label is overlayed by Vietnam geometry.

I used the text-dy property to move the label, but of course it distorted other labels , see Laos here . I could create very particular styles for each label problem I have, but I wonder there must be a much more practical approach.

I'm aware that the labels are not in the center of the country (layer downloaded from 1:10M natural Earth), but this should not be a reason of these problems, right?

In any case, even if the labels are on the center, I find strange problems: see it: some labels are shorted ('Republique Centra' should be 'République Centrafricaine',see also 'République Démocratique du Congo'....)

Some idea?
I'm using Tilemill 0.9 over a MacOS 10.6.8

thanks in advance,

Pere

  1. 2 Posted by perikut on 22 Feb, 2012 12:25 PM

    perikut's Avatar

    well, i used labels coming from Natural Earth 10m-admin-0-country-points (instead of using labels in country polygons from Natural Earth) and most problems are solved...(?)

    only a label doesn't fit well, which is quite easy to hack (but I wonder why it happens...)

    thanks,

    Pere

  2. Support Staff 3 Posted by AJ on 22 Feb, 2012 03:48 PM

    AJ's Avatar

    Hi Pere,

    Your first issue was caused because applying labels to polygon layers is a bit quirky - when you do this you should either add the labels as a separate layer, or use the Carto attachment syntax like this:

    #countries {
      polygon-fill: #f00;
      ::labels {
        text-name: "[name]";
        text-face-name: "Arial Bold";
      }
    }
    

    Note that the ::labels subsection comes after the polygon-fill definitions - this is important for keeping them on top.

    Your second issue is a side effect of the way TileMill splits the map up into tiles.. if your labels are too long they can leak outside of the tile they started on, and the next tile over doesn't always get the message. One method to combat this is to add a text-wrap-width parameter to your label style and set it to something like 50-150. This will wrap your labels into multiple lines to keep them from getting too wide.

    Let me know if you have any other questions.

  3. AJ closed this discussion on 01 May, 2012 03:57 PM.

Comments are currently closed for this discussion. You can start a new one.

Recent Discussions

19 May, 2013 09:28 PM
19 May, 2013 09:03 PM
19 May, 2013 06:42 PM
19 May, 2013 06:06 PM
19 May, 2013 05:49 PM

 

19 May, 2013 04:52 PM
19 May, 2013 08:28 AM