Introduction to the OpenGeo Suite
We styled our earth vector layers in GeoServer using existing SLD files; however, our smallworld layer remains stark and unattractive.
In this section we’ll use GeoExplorer’s graphic styling tool to apply cartographic styles to a layer.
GeoExplorer makes changes directly to GeoServer SLDs, and will completely overwrite SLD files on the server. It is always a good idea to make a backup copy of your SLDs before using GeoExplorer for styling.
If you aren’t logged in, click the login button and provide your GeoServer administrator credentials: admin / geoserver.
Select the smallworld layer and then click the Edit Styles button (the palette icon).
The Edit Styles dialog opens.
In the Styles (upper) panel, click the Add (+) button to open the User Style dialog.
The new style is automatically given a name based on the current layer and a unique identifier. Provide the style with a friendlier Title (e.g. “Smallworld Points”) and Abstract (e.g. “GeoExplorer user style for Smallworld point features”), and click Save.
The Edit Styles dialog re-appears, displaying a single untitled style rule for the current layer.
Select this rule, and click Edit to open the – The Style Rule editor opens.
Make some basic changes to the rule.
- Give it a new Name.
- Change the Symbol type.
- Alter the Fill and Stroke (outline) properties.
Without closing the editor, click the Labels tab. We’ll set our style to display the year of our visit to each city.
- Check the box next to Label Features to enable labeling.
- In the expanded dialog, select Year from the Label Values drop-down.
- Optionally, experiment with the font, color, and halo options for the label style.
Click Save to persist the SLD changes, and close the dialog.
Now you’ve got style!
Explore the Advanced style rule options.
- Limit by scale
- Limit by condition
You probably noticed that we can have more that one Rule within a style. How do you think we could use that?
Navigate back to GeoServer, and have a look at the SLD code that GeoExplorer created.
Boundless provides commercial open source software for internet mapping and geospatial application development. We are dedicated to the growth and support of open source software.
This work is licensed under a Creative Non Commercial-Commons Attribution-Share Alike 3.0 United States License. Feel free to use this material, but we ask that you please retain the Boundless branding, logos and style.