.. _geoserver.sld_basic.external_graphic:

External Graphics with SLD
--------------------------

The style added in the previous section is very basic. With point based data it is often desired to style the point with an existing glyph or icon. This section covers the task of modifying a point style to render a graphic contained in an existing image file.

#. From the `Welcome Page <http://localhost:8080/geoserver>`_ return to the style editor by navigating :menuselection:`Config --> Data --> Style`. Select :guilabel:`bus_stop_style` from the drop down and click :guilabel:`Edit`.

   .. figure:: sld_create5.jpg

      Editing the bus_stops_style

#. Between the ``<PointSymbolizer></PointSymbolizer>`` tags add the following XML:

   .. code-block:: xml

       <Graphic>
         <ExternalGraphic>
           <OnlineResource xlink:type="simple" xlink:href="bus.png" />
           <Format>image/png</Format>
         </ExternalGraphic>
       </Graphic>


   .. figure:: sld_create6.jpg
  
      Adding an external graphic

   .. note:: The ``<ExternalGraphic>`` element is used to render a point using a pre-existing icon in a jpeg, gif, png, svg, etc... format. In this example an icon named :file:`bus.png` is being used.

#. :guilabel:`Submit`, :guilabel:`Apply`, and :guilabel:`Save` changes.

#. Refresh the **Map Preview**.

   .. figure:: sld_create7.jpg

      The bus_stops_style rendered with an external graphic.

At this point the SLD created from scratch is more interesting than a red dot but is still lacking. The next few sections focus on adding improving the style.