1

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" 
 xmlns="http://www.opengis.net/sld" 
 xmlns:ogc="http://www.opengis.net/ogc" 
 xmlns:xlink="http://www.w3.org/1999/xlink" 
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <!-- a Named Layer is the basic building block of an SLD document -->
  <NamedLayer>
    <Name>default_point</Name>
    <UserStyle>
    <!-- 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 -->
      <FeatureTypeStyle>
        <Rule>
          <Name>rule1</Name>
          <Title>platform</Title>
          <Abstract>Platform icon</Abstract>
            <PointSymbolizer>
                <Graphic>
                    <ExternalGraphic>
                        <OnlineResource xlink:type="simple" xlink:href="26 SUSPENDED-OILSHOW.svg"/>
                        <Format>image/svg+xml</Format>
                    </ExternalGraphic>
                    <Size>20</Size>
                </Graphic>
          </PointSymbolizer>
        </Rule>
      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>

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 '16 at 18:16
  • Yes I have tried that – risail Jul 8 '16 at 18:17
  • have you tried not having a space in the path? – Ian Turton Jul 8 '16 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 '16 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 '16 at 10:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.