This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

Change svg size by definition in .mss files

2

During carto style definition I would like to enlarge some svg's icons depends on zoom level. I'm wondering if it's possible to override some SVG file attributes in .mss files? In example I would like to override width and height value defined already in SVG file. Or scale up svg for specific scale.
For example: [highway = 'motorway_link'] { [zoom >= 16 ] { marker-scale: 2; } marker-fill: @motorway-oneway-arrow-color; }

or

[highway = 'motorway_link'] { [zoom >= 16 ] { marker-width: 15; marker-height: 15; } marker-fill: @motorway-oneway-arrow-color; }

asked 23 Mar '21, 10:30

engopy's gravatar image

engopy
126101015
accept rate: 0%


One Answer:

3

Please look at the Mapnik documentation, there are some marker-related functions like marker-transform:

https://cartocss.readthedocs.io/en/latest/mapnik_api.html#markers

answered 23 Mar '21, 10:47

kocio's gravatar image

kocio
2.1k12341
accept rate: 20%

3

I wasn't aware there are so many possible configurations for SVG. actually: marker-width: marker-height: does what I needed Thanks

(23 Mar '21, 14:04) engopy

Exactly what you have ordered... :-)

(23 Mar '21, 14:12) kocio

Source code available on GitHub .