.. _geoserver.styler.styler_scale:

Scale Depending Rendering with Styler
-------------------------------------

The style created in the previous section lacks some scale rules. In a previous module scale dependence was added by editing XML directly. In this section scale dependence will be added via the Styler.

#. Using the :guilabel:`Zoom Slider` on the left zoom to an approximate scale of 1:550,000.

   .. figure:: styler_scale1.jpg

      Zooming with the slider

   .. note:: At any time the current scale can be viewed by hovering over the zoom slider. This can be useful when setting up scale dependent style rules.

      .. figure:: styler_scale2.jpg
         :align: center

#. Edit the :guilabel:`Bus` style by clicking on the rule in the :guilabel:`Legend` panel.

#. On the :guilabel:`Basic` tab change the :guilabel:`Name` to "Bus > 155K"

   .. figure:: styler_scale3.jpg

      Changing the name of a style

#. On the :guilabel:`Advanced` tab click the :guilabel:`add condition` button

   .. figure:: styler_scale4.jpg

      Adding a condition to a style filter

#. Set the :guilabel:`Match` drop down to :guilabel:`all`.

#. Add the condition "shape_leng > 50000" and :guilabel:`save` the style.

   .. note:: The "shape_leng" represents the overall length of the transit route. Supplementing the scale filter with this conditional filter creates the affect of longer transit routes showing up at larger scales.

   .. figure:: styler_scale5.jpg

      Filtering the bay_area_bus_routes layer      

#. Zoom in two levels to an approximate scale of 1:135,000.

#. In the :guilabel:`Legend Panel` click the :guilabel:`Add new` button.

#. Add a new style rule with:

   * :guilabel:`Name`: "Bus 155K - 35K"
   * :guilabel:`Color`: Same as :guilabel:`Bus > 155K` style (green).
   * :guilabel:`Min scale limit`: "35000"
   * :guilabel:`Max scale limit`: "155000"
   * :guilabel:`Condition`: Match :guilabel:`all` of:
    
     * "class = Bus"
     * "shape_leng > 20000"
     * "shape_leng < 50000"

   .. figure:: styler_scale6.png
      :width: 650

      Adding a style at the 155K - 35K scale

#. Save the :guilabel:`Bus 155 - 35k` style.

#. Add a third style rule that similar to the one added in steps 8 through 10 with:

   * :guilabel:`Name`: "Bus < 35K"
   * :guilabel:`Color`: Same as :guilabel:`Bus > 155K` style (green).
   * :guilabel:`Max Scale`: "35000"
   * :guilabel:`Condition`: Match :guilabel:`all` of:
    
     * "class = Bus"
     * "shape_leng < 20000"

   .. figure:: styler_scale7.png 
      :width: 650

      Adding a style at the < 35K scale

#. Zoom the map in and out to verify the scale dependent rules.

   .. figure:: styler_scale8.jpg

      Viewing style change based on scale

Up to this point SLD styles have been created by editing XML directly, and via the Styler application. In the :mod:`next <geoserver.sld_advanced>` module an SLD style will be created with a combination of the two.