#

## OpenGeo Stack Workshop

# Creating a Road SLD with Styler

This section reiterates over topics covered in the previous module to use the Styler application to build up a style for a roads layer.

1. Navigate to the Config page and create a new style named “roads_style”.

   Creating a new style

2. In the SLD Editor create the basic line style with the following XML:

       <StyledLayerDescriptor version="1.0.0"
          xmlns="http://www.opengis.net/sld"
          xmlns:ogc="http://www.opengis.net/ogc">

          <NamedLayer>
            <Name>Transit Routes</Name>
            <UserStyle>

              <FeatureTypeStyle>
                <Rule>
                  <LineSymbolizer>
                    <Stroke/>
                  </LineSymbolizer>
                </Rule>
              </FeatureTypeStyle>

            </UserStyle>
          </NamedLayer>

       </StyledLayerDescriptor>

   Creating the new roads_style

3. Submit, Apply, and Save changes.

4. Change the default style of the bay_area_roads feature type to the roads_style created in the previous step.

   Changing the default style of bay_area_roads

5. Submit, Apply, and Save.

6. Launch the styler application by navigating to http://localhost:8080/geoserver/www/styler/index.html in the web browser.

7. Select the bay_area_roads layer in the Layers panel and make it the active layer for styling.

   Activating the bay_area_roads layer for styling

8. Turn on the bay_area_coastline layer by checking the check box in the Layers panel.

   Turning on the coastline layer

9. Using skills learned in the `geoserver.styler` module, add the following styling rules:

   Note

   The styles created in this section are grouped into three categories based on the type of road. Highway for highways and motorways, Primary for major streets, and Secondary for minor streets.

   1. A rule named “Highway 1:700K - 1:180” with:

      - Color: #e6d050 (dark yellow)
      - Width: “1.5”
      - Label: “name”
      - Min scale limit: “180000”
      - Max scale limit: “700000”
      - Condition: “type = highway”

      Creating the highway at 1:700K - 1:180K style rule

10. Zoom to a scale less than 1:180K and add the following styling rules:

    1. A rule named “Highway 1:180K - 1:20K” with:

       - Color: #e6d050 (dark yellow)
       - Width: “3”
       - Label: “name”
       - Min scale limit: “20000”
       - Max scale limit: “180000”
       - Condition: “type = highway”

       Creating the highway at 1:180K - 1:20K style rule

    2. A rule named “Primary 1:180K - 1:20K” with:

       - Color: #fbf59c (light yellow)
       - Width: “1.5”
       - Min scale limit: “20000”
       - Max scale limit: “180000”
       - Condition: “type = primary”

       Creating the primary at 1:180K - 1:20K style rule

    3. A rule named “Secondary 1:180K - 1:20K” with:

       - Color: #cccccc (grey)
       - Min scale limit: “20000”
       - Max scale limit: “180000”
       - Condition: “type = secondary”

       Creating the secondary at 1:180K - 1:20K style rule

11. Zoom to a scale less than 1:20K and add the following styling rules:

    1. A rule named “Highway 1:20K - 1:5K” with:

       - Color: #e6d050 (dark yellow)
       - Width: 8
       - Label: “name”
       - Min scale limit: “5000”
       - Max scale limit: “20000”
       - Condition: “type = highway”

       Creating the highway at 1:20K - 1:5K style rule

    2. A rule named “Primary 1:20K - 1:5K” with:

       - Color: #fbf59c (light yellow)
       - Width: 4
       - Label: “name”
       - Max scale limit: “5000”
       - Max scale limit: “20000”
       - Condition: “type = primary”

       Creating the primary at 1:20K - 1:5K style rule

    3. A rule named “Secondary 1:20K - 1:5K” with:

       - Color: #ffffff (white)
       - Label: “name”
       - Min scale limit: “5000”
       - Max scale limit: “20000”
       - Condition: “type = secondary”

       Creating the secondary at 1:20K - 1:5K style rule

12. Zoom to a scale less than 1:5K and add the following styling rules:

    1. A rule named “Highway < 1:5K” with:

       - Color: #e6d050 (dark yellow)
       - Width: 10
       - Label: “name”
       - Max scale limit: “5000”
       - Condition: “type = highway”

       Creating the highway at < 1:5K style rule

    2. A rule named “Primary < 1:5K” with:

       - Color: #fbf59c (light yellow)
       - Width: 8
       - Label: “name”
       - Max scale limit: “5000”
       - Condition: “type = primary”

       Creating the primary at < 1:5K style rule

    3. A rule named “Secondary < 1:5K” with:

       - Color: #ffffff (white)
       - Label: “name”
       - Max scale limit: “5000”
       - Condition: “type = secondary”

       Creating the secondary at < 1:5K style rule

At this point the base for the road style has been created entirely with the Styler application. In the next section the resulting SLD will be hand edited to add some advanced features.

### Navigation

- index
- modules |
- next |
- previous |
- OpenGeo Stack Workshop »
- Advanced Styling with SLD »
- Creating a Road SLD with Styler