1

I'm struggling with text-placement: line; in Mapbox Studio. I'm fighting between 1 label being cut-off and 2 labels cutting each other off.

Labels on a line

I'm trying to label fjords in Alaska. Originally, I had the line that followed the length of the fjords, but when I labeled them in Mapbox Studio the label repeated again and again. The fjords make a large Y shape so I broke up the lines into 3 legs roughly the length of the text I want to appear.

In one section the label goes from being cut-off to 2 labels cutting each other off.

I've tried tweaking 'text-character-spacing' and 'text-size' with no luck and I'm tempted to edit the lines in some way of getting the length just right, but it could take hours to tweak everything just right.

Easiest solution I think would be if you could force 1 label per segment but I can't find any documentation or examples of doing that.

Any suggestions?

Edit: I need to mention I've also tried 'text-repeat-distance' and 'text-min-distance' and they don't seem to do anything.

Edit 2: I created a gist in case someone wanted to work with the data and test it out. Gist with link to data source and cartocss

  • I spent hours making minor adjustments to text character spacing, text height, the angle selector, and the data itself. I split the data into multiple parts and layers. I'm satisfied now with the result but I think there must be a better way. – jfact0ry Mar 20 '15 at 21:16
  • Could you provide your project.yml and project.xml? I created a new project, added your remote tile source, and didn't find any data/vectors to view. – Will. Apr 10 '15 at 17:46
1

Setting the text-avoid-edges attribute to true probably can help. This should place the labels near the center of the tile, so they are less likely to be cut.

//source for strait label data is jfactory.11d0a600
#strait_labels [zoom=12] {
  text-name: [name];
  text-character-spacing: 7;
  text-face-name: "Quintessential Regular";
  text-fill: darken(saturate(@water, 20), 10);
  text-halo-fill: @glacier;
  text-halo-radius: 1;
  text-halo-rasterizer: fast;
  text-size: 36;
  text-placement: line;
  text-spacing: 360; //ineffective?
  text-opacity: .7;
  text-repeat-distance: 10; //ineffective? 

  //try this:
  text-avoid-edges: true;
}
  • Can you confirm that text-repeat-distance is in fact ineffective or do you have a suggestion how I can get it to work? – knl Feb 25 '17 at 22:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.