Labeling problem
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.
-
example.png
55.1 KB
Comments are currently closed for this discussion. You can start a new one.
Support Staff 2 Posted by Tom MacWright on 03 Jul, 2012 02:27 PM
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
3 Posted by Anton on 04 Jul, 2012 04:41 AM
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.
Support Staff 4 Posted by ian villeda on 04 Jul, 2012 03:42 PM
Anton,
I think you actually want text-min-distance. Let me know if that helps
-ian
Support Staff 5 Posted by Dane on 04 Jul, 2012 06:08 PM
Hi Anton,
Tom is right that
spacingcan 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 mentionstext-min-distancewhich 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
spacingparameter should start behaving more usefully.Will White closed this discussion on 16 Nov, 2012 06:38 PM.