.. _rendering_selection: Rendering Selection ==================== GeoServer provides a ``VendorOption`` to define whether a particular element ``Rule``, ``FeatureTypeStyle`` or ``Symbolizer`` should be applied to a ``getLegendGraphic`` output or to a ``getMap`` output. This allows to generate legends from the SLD that can be better looking and more expressive, without the underlying complexity of the actual rendered style. Other systems have a dedicated language to build legends instead. The advantage of using the same language is that dynamic behaviors, like rule removal based on the area being rendered, can be easily retained. The vendor option is named ``inclusion``, e.g.: * legendOnly * mapOnly Valid values are: * ``legendOnly`` the element will be skipped when applying the style to the data to render map. * ``mapOnly`` the element will be skipped when applying the style to the data to render legend. * ``normal`` will have the same effect then omitting the VendorOption: the SLD element will be used for both map and legend (same effect as not specifying the vendor option). Take as an example the following style: for each Rule two symbolizers are defined one that will be skipped when rendering the legend and one that will be skipped when rendering the map and loads the legend icon from an external svg file. .. code-block:: xml Style example numericValue 90 circle 0xFF0000 32 mapOnly image/svg+xml 20 legendOnly numericValue 90 numericValue 180 circle #6495ED 32 mapOnly image/svg+xml 20 legendOnly The same result could have been obtained by defining each rule two time each one with a single symbolizer, and defining the vendor options at the rule level. .. code-block:: xml Style example numericValue 90 circle 0xFF0000 32 mapOnly numericValue 90 numericValue 180 circle #6495ED 32 mapOnly numericValue 90 image/svg+xml 20 legendOnly numericValue 90 numericValue 180 image/svg+xml 20 legendOnly A third way to obtain the same result could be to define vendor options at the FeatureTypeStyle level. .. code-block:: xml Style example numericValue 90 circle 0xFF0000 32 numericValue 90 numericValue 180 circle #6495ED 32 mapOnly numericValue 90 image/svg+xml 20 numericValue 90 numericValue 180 image/svg+xml 20 legendOnly