index.rst 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. .. _style_quickstart:
  2. Publishing a style
  3. ==================
  4. This tutorial walks through the steps of defining a style and associating it with a layer for use.
  5. .. note:: This tutorial assumes that GeoServer is running at ``http://localhost:8080/geoserver``.
  6. Data preparation
  7. ----------------
  8. First let's gather that the data that we'll be publishing.
  9. #. Complete the previous tutorials:
  10. * :ref:`geopkg_quickstart` defining the `tutorial:countries` layer
  11. * :ref:`image_quickstart` defining the `tutorial:shaded` layer
  12. * :ref:`group_quickstart` defining the `tutorial:basemap` layer
  13. Create a style
  14. --------------------
  15. #. Navigate to :menuselection:`Data > Style` page.
  16. .. figure:: images/styles_page.png
  17. Styles
  18. #. This page displays a list of styles, including the workspace the style belongs to.
  19. .. note:: Styles groups are allowed to be "global" allowing a style to be defined that can be used by any layer.
  20. #. At the top of the list :guilabel:`Styles` list, locate and click the :guilabel:`Add a new style` link.
  21. #. Locate :guilabel:`Style Data` and define the style:
  22. .. list-table::
  23. :widths: 30 70
  24. :width: 100%
  25. :stub-columns: 1
  26. * - Name
  27. - :kbd:`background`
  28. * - Workspace
  29. - ``tutorial``
  30. * - Format
  31. - ``SLD``
  32. .. figure:: images/style_data.png
  33. Style data
  34. #. Locate :guilabel:`Style Content` and carefully:
  35. * Under :guilabel:`Generate a default style` select ``Polygon``
  36. .. figure:: images/style_content.png
  37. Style Content configured to generate a polygon default style.
  38. #. Under :guilabel:`Generate a default style` locate and click the :guilabel:`Generate` link to populate the style editor with a generated outline of a polygion style.
  39. .. figure:: images/generate.png
  40. #. Press the :guilabel:`Apply` button to define this style.
  41. Now that the style is defined there are more options for interactively working with the style.
  42. #. Change to :guilabel:`Publishing` tab.
  43. * Use the search to filter with ``tutorial`` to locate ``tutorial:countries``.
  44. * Select the :guilabel:`Default` checkbox for ``tutorial:countries`` to use the ``tutorial:background`` style the default for this layer.
  45. .. figure:: images/publish.png
  46. Style publish
  47. #. Next to :guilabel:`Publishing` navigate to the :guilabel:`Layer Preview` tab.
  48. * Locate the :guilabel:`Preview on layer` and click on the link to select ``tutorial:countries`` as a dataset to use when editing the style.
  49. .. figure:: images/preview.png
  50. Styled editor Layer Preview tab
  51. #. Edit your style by inserting ``fill-opacity`` value of ``0.25``.
  52. .. literalinclude:: files/background.sld
  53. :language: xml
  54. :emphasize-lines: 17
  55. #. Press :guilabel:`Apply` to edit your style and check the resulting visual change in the layer preview.
  56. #. Experiment with:
  57. * Updating the title information, watching the displayed legend change
  58. * Full screen mode for side-by-side editing
  59. .. figure:: images/full.png
  60. Full screen mode
  61. #. When this style is used as part of the ``tutorial::basemap`` the ``fill-opacity`` allows the shaded relief detail to be shown.
  62. .. figure:: images/basemap.png
  63. Basemap with background style applied to countries