OpenGeo

OpenGeo Stack Workshop

Previous topic

Styling with the GeoExt Styler

Next topic

Thematic Styling with Styler

Creating a New Line SLD

Before using the Styler application a new style must be first created for the layer being styled. This section covers the task of creating a new line style SLD from scratch, reiterating over topics covered in previous modules.

  1. From the Config Page navigate to Data ‣ Style ‣ New.

  2. Enter “transit_routes_style” in the text field and click New.

    ../_images/line_sld_create1.jpg

    Creating the transit_routes_style

  3. In the SLD Editor enter 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>
    

    Note

    The above XML snippet creates a <LineSymbolizer> with all the default values. This will result in a blank link 1 pixel wide.

    ../_images/line_sld_create2.jpg

    Creating a basic line SLD

  4. Submit, Apply, and Save changes.

  5. Using skills learned in the geoserver.basics module, modify the default style of the bay_area_transit_routes feature type to the newly created transit_routes_style.

    ../_images/line_sld_create3.jpg

    Changing the default style of the bay_area_transit_routes feature type

  6. Use the Map Preview to preview the new style.

    ../_images/line_sld_create4.jpg

    Previewing the bay_area_transit_routes layer with the transit_routes_style applied

At this point a new style is in place. In the next section the Styler application will be used to modify it.