Layer Styling

Maps are helpful because they allow you gain a deeper understanding of your data by allowing you to visualize it in many different ways. So you can tell different stories depending on how the data is presented. For any given data or layer, you should explore different styling options and choose the best style for that.

In GeoNode each layer has a Default Style which is determined by the nature of the data you’re mapping. When uploading a new layer (see Layers Uploading) a new default style will be associated to it.

../../_images/layer_default_style.png

Default Style for Layers

Referring to the example above, dark orange lines are not very good to represent waterways so we would need to change this style. In the following paragraphs you will learn how to create a new style starting from given templates, how to edit a style, how to upload styles from file and how to manage them.

Creating new Styles

In order to create a new style, open the Layer Page (see Layer Information) and click on Editing Tools. Then click the Edit button in the Styles section of the Layer Editing panel (see the picture below).

../../_images/edit_style_button.png

Edit Styles button

The Layer will open in a new Map. The Styles Panel will show you all the available styles for the layer and some useful tools.

../../_images/styles_map_panel.png

The Styles Panel in the Map

Now follow the steps below:

  1. Click the create_new_style_button button. The Style Templates Panel will open.
../../_images/create_new_style_from_templates.png

Create new Styles

  1. Choose a Style Template from the list (both CSS and SLD styles are available).
../../_images/style_templates.png

Style Templates

  1. Click the add_style_button button to add the Style Template to the styles list.
  1. Insert a Title and an Abstract (optional), then click on Save.
../../_images/new_style_title.png

Title and Abstract for new Styles

The style you have created is now added to the Styles List.

../../_images/new_style_in_list.png

New Styles into the list

You will also see this new style in the Layer Page.

../../_images/new_style_in_layer_page.png

The Layer Page with the new Style

Now you can switch the style by clicking on the corresponding checkbox.

It would be nice to change the style in order to decrease the opacity of the filling color as well as to reduce the lines width. The embedded MapStore makes available a powerful Style Editor to accomplish that tasks. In the next paragraph we will explain how.

Editing the Layer Style

The following steps show you how to edit styles:

  1. From inside the map open the TOC (Table Of Content) by clicking the toc_button button
  2. Click on layer_settings_button
  3. Open the Style tab style_tab

Warning

Styles editing is allowed only to those users who have the needed permission. See Changing the Layer Permissions to read more)

  1. Select the Style and click on style_editor_button
  2. Edit the style. The Style Editor helps you to write valid styles through the Syntax Validator which shows you a popup in case of errors (see the picture below).
../../_images/style_editor_syntax_validator.png

The Style Editor Syntax Validation

  1. Click on save_style_button to save your changes.

See the following gif to recap the whole process.

../../_images/style_editor.gif

The Style Editor

You can also decide to make your new style the Default Style of that layer. Click on set_style_as_default_button to do that.
Click on delete_style_button to delete the style.

Uploading Styles

In GeoNode it is also possible to upload an existing style from file.

Warning

Currently only styles in SLD (Style Layer Descriptor 1.0, 1.1) format can be uploaded in GeoNode.

From the Layer Page click on Editing Tools to open the Editing Tools panel and follow the steps below:

  1. Click the Upload button of the Styles section
../../_images/upload_style_button.png

Upload Styles button

  1. Click on Choose Files and select your style from your disk
../../_images/upload_styles.png

Upload Styles

  1. Click on Upload files

Once the process has been finished the new Style will be visible in the Layer Page.

Managing Styles

Given a layer, you can manage all its styles in the Styles Management Page accessible from the Manage button of the Layer Editing panel.

../../_images/manage_styles.png

Managing Styles

In that page you can:

  • See the Layer Name
  • Add/remove styles to/from the Available styles list
  • Choose the Layer Default Style from the Available styles list

Click on Update Available Styles to save your changes.