.. _geoserver.sld_basic.sld_create:

Creating a New SLD
------------------

In previous modules the style for a layer was configured by uploading an existing SLD. In this section the task of creating a new SLD document from scratch will be covered.

#. From the `Welcome Page <http://localhost:8080/geoserver>`_ navigate to :menuselection:`Config --> Data --> Style --> New`.

#. Enter "bus_stops_style" in the text field and click :guilabel:`New`

   .. figure:: sld_create1.jpg

      Creating a new style

#. In the :guilabel:`SLD Editor` enter in the following XML:

   .. code-block:: xml

      <StyledLayerDescriptor version="1.0.0" xmlns="http://www.opengis.net/sld"          xmlns:ogc="http://www.opengis.net/ogc" xmlns:xlink="http://www.w3.org/1999/xlink">
         <NamedLayer>
           <Name>bus_stops</Name>
           <UserStyle>
             <FeatureTypeStyle>

               <Rule>
                 <PointSymbolizer>
                 </PointSymbolizer>
               </Rule>

             </FeatureTypeStyle>
           </UserStyle>  
         </NamedLayer>
      </StyledLayerDescriptor>

   .. figure:: sld_create2.jpg
 
      Creating a new SLD with the style editor

   .. note:: The above SLD is very basic. The thing to note is the ``<PointSymbolizer>`` element. In SLD a *Symbolizer* is the fundamental unit of styling. It specifies aspects of a style such as color, line width, labeling, and much more.

#. Click :guilabel:`Submit` to add the new SLD, then :guilabel:`Apply` and :guilabel:`Save` changes.

#. Using skills learned in the :mod:`geoserver.basics` module, modify the default style of the :guilabel:`bay_area_bus_stops` feature type to the newly created :guilabel:`bus_stops_style`.

   .. figure:: sld_create3.jpg

      Changing the default style of the bay_area_bus_stops feature type

#. Use the `Map Preview <http://localhost:8080/geoserver/mapPreview.do>`_ to preview the new style.
   
   .. figure:: sld_create4.jpg

      Previewing the bay_area_bus_stops layer with the bus_stops_style applied

At this point a new SLD has been successfully created from scratch. The :ref:`next <geoserver.sld_basic.external_graphic>` section will focus on adding to this very basic SLD to add some more interesting styling.

