Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm trying to use GeoServer to render a point layer with custom symbols. This worked perfectly well when my symbols were PNGs, but we haven't decided exactly what size our symbols should be, so I tried to switch to SVGs instead, to take advantage of their cleaner resizing.

Now GeoServer won't render anything at all. The relevant bits from the log seem to be:

2013-03-18 23:00:51,655 INFO [geoserver.wms] - 
Request: getServiceInfo
2013-03-18 23:00:51,814 WARN [geotools.rendering] - Assuming rendering buffer = 0, but estimation is not accurate, you may want to set a buffer manually
2013-03-18 23:00:51,822 ERROR [lite.StyledShapePainter] - ShapePainter has been asked to paint a null style!!
2013-03-18 23:00:51,826 ERROR [lite.StyledShapePainter] - ShapePainter has been asked to paint a null style!!
2013-03-18 23:00:51,830 ERROR [lite.StyledShapePainter] - ShapePainter has been asked to paint a null style!!
2013-03-18 23:00:51,835 ERROR [lite.StyledShapePainter] - ShapePainter has been asked to paint a null style!!

And so on (I believe once for each feature, but I haven't counted). My SLD is as follows, but it's a near-perfect match for some of the official examples, so I doubt the problem lies there:

<?xml version="1.0" encoding="ISO-8859-1"?>
<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" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd">
  <NamedLayer>
    <Name>Hydrant</Name>
    <UserStyle>
      <Title>Hydrant</Title>
      <FeatureTypeStyle>
        <Rule>
          <Title>Red Square</Title>
          <PointSymbolizer>
            <Graphic>
              <ExternalGraphic>
                <OnlineResource xlink:type="simple" xlink:href="http://www.shastacsd.org/mapport/img/map-symbols/hydrant.svg" />
                <Format>image/svg+xml</Format>
              </ExternalGraphic>
              <Size>12</Size>
            </Graphic>
          </PointSymbolizer>
        </Rule>
      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>

Can anyone think what I'm doing wrong? Thanks in advance if you can!

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

Finally figured out what was going wrong when I fired up Inkscape to take a look at the details of the SVG files. They weren't vector graphics; they were raster images embedded in the SVG format. Fortunately, they were pretty simple, and I solved the problem by making my own - real SVGs this time. So moral of the story:

GeoServer doesn't like to render images embedded in SVGs. Use real vector graphics!

Hope this helps someone else someday...

share|improve this answer
    
Have the same problem.. Thank god I saw this soon. @Xavier: Any quick ways of making 'real svgs' from the png assets I have currently other than this? –  Siva Apr 30 '13 at 11:27
    
I found instructions here. But still I am not able to see the symbols. Any idea what might be going wrong? –  Siva Apr 30 '13 at 11:54
    
@Siva - I'm not sure; my symbols were so simple that I decided to just make a new set in Inkscape rather than try to trace the old ones... Do you have a link to one of your new versions? –  Xavier Holt Apr 30 '13 at 13:58
    
Here you go: imgh.us/treatment_unit.svg –  Siva May 2 '13 at 12:53
    
Hi @Siva - Sorry for the late reply; I'm not around here all that often any more. Anyway, it looks like that SVG file still has the raster image embedded in it, and that's what seems to break GeoServer's renderer. You can actually open up SVGs in a text editor, and that's the simplest way to strip those pixels out (lines 62-127). I'd imagine that once you've done that, it'll render just fine - though without the raster background, the image isn't as recognizable as you might hope... You might want to retrace. Good luck! –  Xavier Holt May 5 '13 at 19:28
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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