multilayer.rst 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. .. _css_multilayer:
  2. Multiple layers in the same CSS
  3. ===============================
  4. As most of the examples in this documentation show, styling is typically done on a single layer.
  5. When the style is associated to a layer, the first UserStyle found in the style sheet is used.
  6. However, it's also possible to create a style with multiple layers, and then use the "style group"
  7. functionality to create a layer group with the layers mentioned in the style.
  8. For example, a style duplicating the Tasmania sample layer group could look like this (usage of
  9. the ``Flat`` mode is recommended):
  10. .. code-block:: scss
  11. @mode 'Flat';
  12. topp:tasmania_state_boundaries {
  13. fill: #66FF66;
  14. stroke: black;
  15. }
  16. topp:tasmania_water_bodies {
  17. fill: #4040C0;
  18. stroke: black;
  19. }
  20. topp:tasmania_roads {
  21. stroke: #AA3333;
  22. stroke-width: 2;
  23. }
  24. topp:tasmania_cities {
  25. mark: symbol(circle);
  26. mark-size: 6;
  27. :mark {
  28. fill: white;
  29. stroke: black;
  30. stroke-width: 2;
  31. }
  32. }
  33. The style can be previewed while editing by enabling the "preview as style group" option in the style editor.
  34. .. figure:: images/tasmania.png
  35. The style group can then be used to form a layer group, by using the "add as style group" link in the
  36. layer group editor:
  37. .. figure:: images/style_group.png