Skip to content

Instantly share code, notes, and snippets.

@stevage
Created June 22, 2013 13:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevage/5840947 to your computer and use it in GitHub Desktop.
Save stevage/5840947 to your computer and use it in GitHub Desktop.
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.
@springmeyer
Copy link

nice work. added a revised version in https://github.com/mapbox/tilemill/commit/f70dc7b7730ea71aefa2461940ba561104f42219.

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