Skip to content

Instantly share code, notes, and snippets.

@stevage stevage/carto layers
Created Jun 22, 2013

What would you like to do?
Proposed text for TileMill/carto's documentation on layer application.
The order in which objects are drawn depends on the following process. Each step in the process overrules steps with higher numbers.
1. Layers. "Higher" layers obscure "lower" ones.
2. Stylesheets. Stylesheets are applied from left to right.
3. Rules within a stylesheet. Rules are applied from top to bottom. This means two things:
a. objects defined by later rules will be drawn over those defined by later rules; and
b. attachments may be redefined by later rules.
4. Attachments (eg, `::glow { ... }`) within a rule are applied from top to bottom. (The order of different symbolizers within an attachment doesn't matter.)
5. Lastly, all else being equal, objects are drawn in the order in which they are found, such as in PostGIS.
The process of avoiding collisions between text symbolizers (labels) is the same, but the result can be counterintuitive. This only applies to symbolizers with `text-placement: simple;`. When rules are applied, labels claim space that will be avoided by later rules. This means that, for example, a label defined by a rule in a layer may prevent a label in a "higher" layer being drawn, even though it is drawn "beneath" it.

This comment has been minimized.

Copy link

springmeyer commented Aug 12, 2013

nice work. added a revised version in

The order of different symbolizers within an attachment doesn't matter is not a true generally so I removed that. I also removed This only applies to symbolizers withtext-placement: simple;`` which I felt was slightly confusing, but I agree that this issue of how labels greedily take space needs better treatment, perhaps in a separate dedicated section?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.