Labeling problem

Anton's Avatar

Anton

02 Jul, 2012 12:49 PM

Hello,

my problems got started from labeling inside polygons. I have to place label inside polygon so that it takes a maximum size inside.
Look at picture to understand what effect i would like.

As i understood that it's not possible with carto and labeling inside polygons i decide to use stringlines objects for directing labeling. It works great for my task but i encountered with new problem is repeating labels. How i can disable reapiting on line ?

Thanks.

  1. Support Staff 2 Posted by Tom MacWright on 03 Jul, 2012 02:27 PM

    Tom MacWright's Avatar

    Hi Anton,

    You can try using text-spacing and setting it to a high number to prevent Mapnik from placing more than one text label on each line.

    Tom

  2. 3 Posted by Anton on 04 Jul, 2012 04:41 AM

    Anton's Avatar

    Hello Tom,

    i have tried all available options. "text-spacing" does nothing. Also i've tries all another available combinations of options.

    f_labels {

    [zoom >= 15] { text-allow-overlap: true; text-size: 40; text-name: "[text]"; text-face-name:@dejavu; text-placement: line; text-spacing: 100000; text-fill:@country_text; text-halo-fill: @country_halo; text-halo-radius: 1; }

    i think this style does not work, but i don't know it's either carto or tilemill or mapnik problem.

    Thanks.

  3. Support Staff 4 Posted by ian villeda on 04 Jul, 2012 03:42 PM

    ian villeda's Avatar

    Anton,

    I think you actually want text-min-distance. Let me know if that helps

    -ian

  4. Support Staff 5 Posted by Dane on 04 Jul, 2012 06:08 PM

    Dane's Avatar

    Hi Anton,

    Tom is right that spacing can work within a given line to reduce the amount of labels placed. But in situations were line segments are small, then the only other current method is to use, as Ian mentions text-min-distance which works across features. However, in the current Mapnik version which is used in TileMill, this feature is only working for shields and not text along a line. See this issue https://github.com/mapnik/mapnik/issues/995, which is planned to be fixed before the next TileMill release.

    So, in the meantime a potential workaround for you - for sparser text along lines - would be to import into PostGIS and then merge your lines into larger continuous segments. At this point a higher spacing parameter should start behaving more usefully.

  5. Will White closed this discussion on 16 Nov, 2012 06:38 PM.

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