multivalueprops.rst 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. .. _css_multivalueprops:
  2. Multi-valued properties
  3. =======================
  4. .. highlight:: css
  5. When rendering maps, it is sometimes useful to draw the same feature multiple
  6. times. For example, you might want to stroke a roads layer with a thick line
  7. and then a slimmer line of a different color to create a halo effect.
  8. In GeoServer's ``css`` module, all properties may have multiple values. There
  9. is a distinction between complex properties, and multi-valued properties.
  10. Complex properties are separated by spaces, while multi-valued properties are
  11. separated by commas. So, this style fills a polygon once::
  12. * {
  13. fill: url("path/to/img.png") red;
  14. }
  15. Using ``red`` as a fallback color if the image cannot be loaded. If you wanted
  16. to draw red on top of the image, you would have to style like so::
  17. * {
  18. fill: url("path/to/img.png"), red;
  19. /* set a transparency for the second fill,
  20. leave the first fully opaque. */
  21. fill-opacity: 100%, 20%;
  22. }
  23. For each type of symbolizer (``fill``, ``mark``, ``stroke``, and
  24. ``label``) the number of values determines the number of times the feature
  25. will be drawn. For example, you could create a bulls-eye effect by drawing
  26. multiple circles on top of each other with decreasing sizes::
  27. * {
  28. mark: symbol(circle), symbol(circle), symbol(circle), symbol(circle);
  29. mark-size: 40px, 30px, 20px, 10px;
  30. }
  31. If you do not provide the same number of values for an auxiliary property, the
  32. list will be repeated as many times as needed to finish. So::
  33. * {
  34. mark: symbol(circle), symbol(circle), symbol(circle), symbol(circle);
  35. mark-size: 40px, 30px, 20px, 10px;
  36. mark-opacity: 12%;
  37. }
  38. makes all those circles 12% opaque. (Note that they are all drawn on top of
  39. each other, so the center one will appear 4 times as solid as the outermost
  40. one.)
  41. Inheritance
  42. -----------
  43. For purposes of inheritance/cascading, property lists are treated as
  44. indivisible units. For example::
  45. * {
  46. stroke: red, green, blue;
  47. stroke-width: 10px, 6px, 2px;
  48. }
  49. [type='special'] {
  50. stroke: pink;
  51. }
  52. This style will draw the 'special' features with only one outline. It has
  53. ``stroke-width: 10px, 6px, 2px;`` so that outline will be 10px wide.