Skip to content

Explicit layer ordering? #33

@gravitystorm

Description

@gravitystorm

When I design styles in CartoCSS, I tend to have separate files for each "theme", e.g. roads.mss, water.mss, landcover.mss and so on. These are then included in the main style file. However, each of the theme files contains a mixture of polygon, point, text and icons definitions. Therefore I rely on the explicit layers attribute in project.yml to control the draw ordering, e.g. all polygons from every theme, before any text.

An alternative approach is to split the themes into individual glug files for each layer, and then include them in the desired order, e.g.

include_file 'landcover_polygons'
include_file 'water_polygons'
include_file 'roads_polygons'
include_file 'water_lines'
...
include_file 'water_point_labels'
include_file 'water_line_labels'

This would work, but leads to a bit of an explosion in the number of files required! It splits each theme into multiple files, maybe 3-4 per theme.

My idea would be to just have an array of layer ids, and then after the rest of the stylesheet has been evaluated, the generated layers are filtered and sorted by the contents of that array.

My question, for people who have more experience than I do with glug, is whether an explict "layers" definition would be useful, or whether that's just excessive complexity?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions