Introduction to the OpenGeo Suite

Styling Layers

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.

Interactive styling

Warning

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.

  1. If you aren’t logged in, click the login button and provide your GeoServer administrator credentials: admin / geoserver.

  2. Select the smallworld layer and then click the Edit Styles button (the palette icon).

    ../_images/gx_icon_editstyles.png

    Click to edit styles

  3. The Edit Styles dialog opens.

    ../_images/gx_dialog_editstyles.png

    Edit Styles dialog

  4. In the Styles (upper) panel, click the Add (+) button to open the User Style dialog.

  5. 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.

    ../_images/gx_dialog_userstyle.png

    User Style dialog

  6. The Edit Styles dialog re-appears, displaying a single untitled style rule for the current layer.

    ../_images/gx_dialog_userstylerule.png

    Style Rule editor

  7. Select this rule, and click Edit to open the – The Style Rule editor opens.

  8. Make some basic changes to the rule.

    1. Give it a new Name.
    2. Change the Symbol type.
    3. Alter the Fill and Stroke (outline) properties.
    ../_images/gx_dialog_editrule.png

    Updates to a layer style in GeoExplorer

  9. Without closing the editor, click the Labels tab. We’ll set our style to display the year of our visit to each city.

    1. Check the box next to Label Features to enable labeling.
    2. In the expanded dialog, select Year from the Label Values drop-down.
    3. Optionally, experiment with the font, color, and halo options for the label style.
    ../_images/gx_dialog_stylelabels.png
  10. Click Save to persist the SLD changes, and close the dialog.

Now you’ve got style!

Bonus

  1. Explore the Advanced style rule options.

    • Limit by scale
    • Limit by condition
    ../_images/gx_dialog_advancedstyle.png

    GeoExplorer Advanced style rule options

  2. You probably noticed that we can have more that one Rule within a style. How do you think we could use that?

  3. Navigate back to GeoServer, and have a look at the SLD code that GeoExplorer created.

    ../_images/gx_verifystyle.png

    SLD code generated by GeoExplorer

Previous: Logging in


Continue Reading

Previous: Logging in

Next: Editing Features

This Page

About Boundless

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.

License

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.

Creative Commons License