Reputation: 1436
I am using
"symbol-placement": "line",
to add text labels over polygons (countries) using a precalculated line which spans the country bounds. However, the text label automatically repeats itself which does not look good.
Example: Instead of a curved GERMANY, I get a curved unwanted repetition GERMANY GERMANY GERMANY GERMANY.
I could not find any option for that... Is there a work around?
Bonus question: Is it possible to have the text span the full line and have the font-size dynamically set accordingly? That would be the perfect solution.
Upvotes: 3
Views: 2015
Reputation: 126355
Setting symbol-spacing
to a very high number (eg, 5000) should effectively achieve what you want.
Bonus question: Is it possible to have the text span the full line and have the font-size dynamically set accordingly?
No. But you could set the length of the line as a property on the feature, and use data-driven styling to set the font size from that. Data-driven styling for font-sizes is supported in Mapbox-GL-JS as of version 0.35.
You could potentially also use text-letter-spacing
. That one doesnt' supoprt data-driven styling, but you could use filters to set some basic classes of letter spacing.
Upvotes: 1