I'm using CartoCSS to render maps that include large polygons (like national parks). At higher zoom levels I want labels along the inside of the polygon boundaries, like in OpenStreetMap:

enter image description here

I reviewed the openstreetmap-carto stylesheets but could not find how this is done. Using text-placement: line just places text on the line (this is how streets are labelled). I need it inside the line. Any ideas?

1 Answer 1


try to add this

text-dy: -10;

you can look at file admin.mss in openstreetmap-carto project dir and find code

#nature-reserve-text[zoom >= 13][way_pixels > 192000] {
  text-name: "[name]";
  text-face-name: @book-fonts;
  text-fill: green;
  text-halo-radius: 1.0;
  text-halo-fill: rgba(255,255,255,0.6);
  text-placement: line;
  text-dy: -10;

it will done what you want

and you can also add text-spacing: 30; option it will set the repeat words distance

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.