0

I have several SVGs, the simplest of them is the following SVG:

<?xml version=‘1.0' encoding='utf-8'?>
<svg viewBox="-337 43 2223 1812"
    xmlns="http://www.w3.org/2000/svg">
    <path d="M1508 43h-1528v1528h1528v-1528z" glyph-name="exclam" name= "foreground" fill="rgba(252,133,33,255)" transform="scale(1,-1) translate(0,-1855)" unicode="!" />

</svg>

When I try to render then in GeoServer they all fail to draw and resort to the default marker instead of the orange square I'm expecting (for the simple example). I get a ton of messages "InterpolationConverterFactory can be applied from string to Interpolation only", and every once in a while i get "creating defaultMark".

If I convert the SVGs to PNG it displays fine (and changing the rule format to image/png from image/svg)

My GeoServer version is 2.11.0

The SVGs display okay in Chrome.

  • 1
    You might want to try out 2.14.x, it has a newer version of Batik, the library GeoServer uses to read the SVG files. – Andrea Aime Oct 4 '18 at 15:24
  • Didn't realize they upgraded to the newer batik, will try that, thx – Binyamin Oct 4 '18 at 15:29
0

Looking at this question helped me come up with the following change:

<?xml version="1.0"?>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-337 43 2223 1812">
  <path d="M1508 43h-1528v1528h1528v-1528z" glyph-name="exclam" name="foreground" fill="param(fill) #ff7f2a" transform="scale(1,-1) translate(0,-1855)" unicode="!"/>
</svg>

Which still displays a black rectangle by default but if I include it as

<OnlineResource xlink:type="simple" xlink:href="ian.svg?fill=#ff7f2a" />

does display an orange square. But simple mark with an orange fill would probably work the same but faster.

      <PointSymbolizer>
        <Graphic>
          <Mark>
            <WellKnownName>square</WellKnownName>
            <Fill>
              <CssParameter name="fill">#ff7f2a</CssParameter>
            </Fill>
          </Mark>
          <Size>6</Size>
        </Graphic>
      </PointSymbolizer>
  • i edited the question, i have complex icons and this is just one example, anyways, when i open the file in inkscape it doesn't have any color and when i save it it still doesn't work (saving as inkscape svg or plain svg) – Binyamin Oct 4 '18 at 14:51
  • then you need to edit your question to make this information clear. – Ian Turton Oct 4 '18 at 14:58
  • Hmm ive tried your new suggestion but it didn't work either, do you know any way i could debug the issue? To try and figure out what is causing the problem? – Binyamin Oct 4 '18 at 15:24
  • are you using an old version of geoserver? – Ian Turton Oct 4 '18 at 15:46
  • Yeah 2.11, I'm going to upgrade to 2.14, see if it helps (i hope it will, according to @Andrea Aime they upgraded the library that deals with svg, thank you for helo – Binyamin Oct 4 '18 at 19:07
0

Switching all fill definitions from rgba(..) to the equivalent #fc... solved the problem.

Your Answer

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

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