Using this documentation I have made the below SLD file, attempting to use an svg that I obtained from here I have moved the svg into /var/lib/tomcat7/webapps/geoserver/data/styles but the image will not render when previewing in the geoserver style editor (the return is a grey square). I've gone through this SE post and tried to reverse engineer it and have also used a direct path the result are the same. What am I missing?

<?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor version="1.0.0" 
 xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd" 
  <!-- a Named Layer is the basic building block of an SLD document -->
    <!-- Styles can have names, titles and abstracts -->
      <Title>Default Point</Title>
      <Abstract>A sample style that draws a point</Abstract>
      <!-- FeatureTypeStyles describe how to render different features -->
      <!-- A FeatureTypeStyle for rendering points -->
          <Abstract>Platform icon</Abstract>
                        <OnlineResource xlink:type="simple" xlink:href="26 SUSPENDED-OILSHOW.svg"/>

I was able to get it to work with a direct path xlink:href="file:////var/lib/tomcat7/webapps/geoserver/data/styles/26%20SUSPENDED-OILSHOW.svg" Why will it not work with a relative path?

  • 1
    Have you tried encoding the space as %20 in the relative path?
    – csd
    Jul 8, 2016 at 18:16
  • Yes I have tried that
    – risail
    Jul 8, 2016 at 18:17
  • have you tried not having a space in the path?
    – Ian Turton
    Jul 8, 2016 at 18:54
  • yes I have changed the file to "26SUSPENDED-OILSHOW.svg" and updated the sld accordingly. I'm starting to think that my GEOSERVER_DATA_DIR is not what I think it is if it works with absolute paths but not relative.... Where can I check that?
    – risail
    Jul 8, 2016 at 19:02
  • 1
    I had same problem. I just put a images into data_dir/styles and my url to resource <OnlineResource xlink:href="000D000072F3_0.svg"/> and it works.
    – Kliver Max
    Aug 10, 2016 at 10:10

1 Answer 1


I had the same problem.

In my case, the relative path was wrong.

Check in Server Status (first option in the left menu). There you can see the data directory, and your relative path for the image must start from there.

In your case, if the data directory is /var/lib/tomcat7/webapps/geoserver/data, the image relative path should be /styles/26%20SUSPENDED-OILSHOW.svg

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.