Why not ask your question on the new OpenStreetMap Community Forum?

Hi, In general I try to override colour of motorway shield, but there are many of SVG's files with already defined background colour.
What I want to achieve is not to edit all SVG's but instead of that I would like to define that values directly in .mss files. I got familiar with mapnik documentation but I couldn't find anything related to my problem.
In general the SVG of road shield looks like that:
alt text
(I'm sorry byt I've got problems with pasting that structure as a code..)
And as you can see the colour of shield (fill) and stroke around (stroke) is already defined in file.
Is there a way to override that values directly from style files?

asked 29 Mar '21, 10:30

engopy's gravatar image

accept rate: 0%

edited 29 Mar '21, 10:31

If you are using openstreetmap-carto as a base for your custom style, there is a script called generate_shields.py ( https://github.com/gravitystorm/openstreetmap-carto/blob/master/scripts/generate_shields.py ) that is responsible for the generation of those svg files. And that script refers to generate_road_colours.py ( https://github.com/gravitystorm/openstreetmap-carto/blob/master/scripts/generate_road_colours.py ) and that one uses values as defined in road-colors.yaml ( https://github.com/gravitystorm/openstreetmap-carto/blob/master/road-colors.yaml ).

So to change the appearance of road colours and attached shields, you would have to edit the road-colors.yaml and than run those scripts again to get the svg shield files and the road-colours-generated.mss

permanent link

answered 29 Mar '21, 15:37

Spiekerooger's gravatar image

accept rate: 15%


Yes I use carto by gravitystorm. Thanks, it completely solved my problem.

(30 Mar '21, 11:09) engopy
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 29 Mar '21, 10:30

question was seen: 1,147 times

last updated: 30 Mar '21, 11:09

powered by OSQA