3

Im using Geoserver with PostGIS database to put points to map using GeoExplorer. The points are styled to use SVG icon with fixed size (uom metre, size) so they scale together with the map as user zooms in and out. For now, there are no filters or any other issues. Style code :

<sld:PointSymbolizer uom="http://www.opengeospatial.org/se/units/metre">
        <sld:Graphic>
          <sld:ExternalGraphic>
            <sld:OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="load_icon.php?id=${param}"/>
            <sld:Format>image/svg+xml</sld:Format>
          </sld:ExternalGraphic>
          <sld:Size>80000</sld:Size>
        </sld:Graphic>
      </sld:PointSymbolizer>
      <sld:TextSymbolizer/>

load_icon.php is returning the SVG code for given param :

<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="220" height="110">
<g transform="scale(0.5)">
<g transform="translate(90,50)">                
<rect x="1.5" y="1.5" height="103" width="167" fill="#fff" stroke="red" stroke-width="3"/>
<path d="M3,3 l164,100 m0,-100 l-164,100" stroke="red" stroke-width="3" fill="none"/>
</g>
<text x="173" y="49" text-anchor="middle" font-family="Verdana" font-size="25" fill="red">XXXXX< /text>
<text x="270" y="153" font-family="Verdana" font-size="25" fill="red">G< /text>
</g>
</svg>

I use the plain GeoExplorer to view the icon on the map, but same issue is when connecting the layer as WMS to Leaflet and other libraries.

The icon is showing ok in some resolution : icon ok

but gets cropped as user is zooming in : icon croped

and even more cropped with further zoom : icon more cropped

with tiles that do not contain the part of the icon. There is caching turned off for this layer, no help.

What I am doing wrong here ?

9
  • so after some experimenting, the only solution working so far is to turn SINGLE TILE option on, then the SVG icons do render correctly, but as expected, the loading is bit slower and tends to be more user un-friendly :(
    – Radek
    Commented May 1, 2014 at 22:36
  • 1
    How about to convert SVG icons in PNG icons created for different scale ranges. This would imply different sld Rules, but it probably would improve the performance. Commented May 5, 2014 at 11:03
  • good idea, will give it a try ... another option I was thinking about was to show the layer via GeoJSON and style it on client side, but I didnt progres on that yet.
    – Radek
    Commented May 5, 2014 at 11:20
  • so I did try, and the result is very unsatisfying too :( some of the icons corrupted when loaded via SVG are fixed now, but there are some others which are still corrupted (especially on the border of the tiles)
    – Radek
    Commented May 5, 2014 at 11:49
  • I turned on cache, used Metatiling factors 10x10 tiles and 100px gutter, and now all the icons appear ok
    – Radek
    Commented May 5, 2014 at 12:04

1 Answer 1

5
+50

This happens since the client JavaScript library requests (small) tiles from the GeoServer. I recommend you to use the integrated GeoWebCache as WMS endpoint. In the GeoWebCache settings you can define the metatile size (see Caching Defaults in TileCaching menu), this means GeoServer internally renders a large image and split it into tiles. So you won't have this effect of cut symbols anymore.

Finally change your WMS endpoint from /geoserver/wms to/geoserver/gwc/service/wms

1
  • Dear sir/ma'am, you are absolutly correct, now it works as expected ! Thank you !
    – Radek
    Commented May 6, 2014 at 7:23

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.