I am experimenting with rendering arrows in my CartoCSS stylesheet. I render zero, one or two arrows per line by setting styles on the ::forward and `:backward attachments.
Right now the arrows are rendered at all zoom levels (even when its corresponding line is not actually rendered). I want to configure minimum zoom levels for the markers, and these need to depend on the tags of the way (in particular on the highway type).
I can think of two general approaches how to implement this. One is to enable the markers only for certain selectors. Since it seems like any marker style property enables the rendering of markers for that way, it would mean that I need to repeat all marker style properties in each selector where I want to enable markers. Setting common marker styles in a broader selector is not possible, since it would enable markers for all ways that fit the selector. This would make my code very verbose. The other approach is to disable the markers only for certain selectors. This would make my code much cleaner. I have experimented with this by disabling markers on footpaths for zoom levels <= 15, but I am failing to get it to work.
I have tried different options:
- Setting
marker: nonein the selectors where I want to disable markers does not seem to do anything. In fact, I cannot makemarker: nonework anywhere, it’s like the property is not supported. - Setting
marker-opacity: 0makes tile rendering extremely slow, presumably because it enables markers for all footpaths at all zoom levels (even the ones that should not have arrows). Rendering is so slow that I cannot even find out whether the property works as intended. - Setting
marker-width: 0does not change anything. The markers are still rendered with the default marker width. - Setting
marker-width: 1causes a one-pixel marker to be rendered on all footpaths at all zoom levels (also the ones that shouldn’t have arrows), but still one the ones that should have arrows, those arrows are unaffected by it and still rendered at all zoom levels.
It seems that I am fundamentally misunderstanding something. How can I disable markers altogether for certain selectors?