0

I have built an OpenStreetMap tile server following this guide and everything seems to work fine.

Now I want to customize the look of the generated tiles, and I started with something I tought it was simple: remove mountain peaks from the map.

I was only half succesful however, because I was able to remove the triangular peak marker, but not the peak name.

According to the CartoCSS documentation you can remove a specific symbolizer from the output using the syntax

symbolizer_name: none

So I started to hack the amentity-points.mss like this:

.points {
    //...

    [feature = 'natural_peak'][zoom >= 11] {
      marker: none;
      marker-file: url('symbols/peak.svg');
      marker-fill: @landform-color;
      marker-placement: interior;
      marker-clip: false;
    }

    //..
}

.text-low-zoom[zoom < 10],
.text[zoom >= 10] {
    //..

    [feature = 'natural_peak'][zoom >= 13],
    [feature = 'natural_volcano'][zoom >= 13],
    [feature = 'natural_saddle'][zoom >= 15],
    [feature = 'tourism_viewpoint'][zoom >= 16] {
      text: none;
      text-name: "[name]";
      text-size: @standard-font-size;
      text-wrap-width: @standard-wrap-width;
      text-line-spacing: @standard-line-spacing-size;
      text-fill: darken(@landform-color, 30%);
      [feature = 'natural_volcano'] { text-fill: #d40000; }
      text-dy: 7;
      [feature = 'tourism_viewpoint'] { text-dy: 11; }
      text-face-name: @standard-font;
      text-halo-radius: @standard-halo-radius;
      text-halo-fill: @standard-halo-fill;
      text-placement: interior;
    }

    //..
}

As I said, the peak marker does not get rendered, but its name does.

Am I missing something like another rule overriding my settings?

1

Yes, just keep searching for "peak" further down the file. The names of peaks, volcanos etc. are handled together. Remove the part that is looking for "peak" and the names of peaks will no longer appear.

For some features it's a little more complicated - the name display may be handled in a different .mss file to the icon display, but if you search through the .mss files you'll find what you want.

  • Are you suggesting should I just comment [feature = 'natural_peak']? – sblandin Jul 10 '18 at 15:13
  • Yes, but be careful commenting things out in CartoCSS .mss or .mml files because it can make the result hard to read or invalid. – SomeoneElse Jul 27 '18 at 20:18
  • I am still wondering why the symbolizer_name: none syntax in some cases works and in others don't – sblandin Jul 30 '18 at 7:31

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.