#

## OpenGeo Stack Workshop

# Scale Dependent Rendering with SLD

The style created the previous section is overly crowded and lacks any notion of scale. Setting up styling rules based on current the scale of a map is a basic aspect of cartography. This section covers the task of using scale dependence to control styling at specific scales.

1. Return to the SLD Editor for bus_stop_styles.

2. After the opening `<Rule>` tag add the following XML:

       <MaxScaleDenominator>2500</MaxScaleDenominator>

   Adding scale dependence to the bus_stops_style

   Note

   The `<MaxScaleDenominator>` and `<MinScaleDenominator>` are used to apply a particular SLD rule to a specific scale. In this case it is being used to apply the style only at scales less than 1:2500.

3. Submit, Apply, and Save changes.

4. Return to the map preview for the bay_area_bus_stops layer. In the address bar of the browser modify the layers parameter of the url changing the text “layers=topp:bay_area_bus_stops” to read “layers=topp:bay_area_transit_routes,topp:bay_area_bus_stops”.

   Or alternatively just follow this link.

   Adding the bay_area_transit_routes layer to the map

   Note

   The layer bay_area_transit_routes is added to provide context to the map since the bay_area_bus_stops layer will now only render at smaller scales.

   Viewing the bay_area_bus_stops layer at a large scale

5. Zoom into a specific route and notice as the bay_area_bus_stops layer beings to render noting the scale reported in the lower left corner of the preview.

   Viewing the bay_area_bus_stops layer at a small scale

6. Click one of the bus icons to reveal information about the particular bus stop.

   Viewing information about a bus stop with the map preview

At this point the SLD being built up has appropriate scale rules in place to prevent over crowding. In the next section the SLD will be further improved with some basic labeling.

### Navigation

- index
- modules |
- next |
- previous |
- OpenGeo Stack Workshop »
- Styling with SLD »
- Scale Dependent Rendering with SLD