This section reiterates over topics covered in the previous module to use the Styler application to build up a style for a roads layer.
Navigate to the Config page and create a new style named “roads_style”.
Creating a new style
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
Submit, Apply, and Save changes.
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
Submit, Apply, and Save.
Launch the styler application by navigating to http://localhost:8080/geoserver/www/styler/index.html in the web browser.
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
Turn on the bay_area_coastline layer by checking the check box in the Layers panel.
Turning on the coastline layer
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.
A rule named “Highway 1:700K - 1:180” with:
Creating the highway at 1:700K - 1:180K style rule
Zoom to a scale less than 1:180K and add the following styling rules:
A rule named “Highway 1:180K - 1:20K” with:
Creating the highway at 1:180K - 1:20K style rule
A rule named “Primary 1:180K - 1:20K” with:
Creating the primary at 1:180K - 1:20K style rule
A rule named “Secondary 1:180K - 1:20K” with:
Creating the secondary at 1:180K - 1:20K style rule
Zoom to a scale less than 1:20K and add the following styling rules:
A rule named “Highway 1:20K - 1:5K” with:
Creating the highway at 1:20K - 1:5K style rule
A rule named “Primary 1:20K - 1:5K” with:
Creating the primary at 1:20K - 1:5K style rule
A rule named “Secondary 1:20K - 1:5K” with:
Creating the secondary at 1:20K - 1:5K style rule
Zoom to a scale less than 1:5K and add the following styling rules:
A rule named “Highway < 1:5K” with:
Creating the highway at < 1:5K style rule
A rule named “Primary < 1:5K” with:
Creating the primary at < 1:5K style rule
A rule named “Secondary < 1:5K” with:
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.