2

I have set up a map file on Ubuntu 16.04 with SVG symbols created by Inkscape. Everything is fine. Now I have to port it to a windows server. I installed MS4W, but layers with SVG symbols can't be rendered, the error message is:

[Thu Jan 04 10:08:39 2018].979000 msPreloadSVGSymbol(): Renderer error. problem parsing svg symbol

The MapServer version:

MapServer version 7.0.7 (MS4W 3.2.3) OUTPUT=PNG OUTPUT=JPEG OUTPUT=KML SUPPORTS=PROJ 
SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=CAIRO SUPPORTS=SVG_SYMBOLS SUPPORTS=SVGCAIRO 
SUPPORTS=ICONV SUPPORTS=FRIBIDI SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT 
SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=SOS_SERVER 
SUPPORTS=FASTCGI SUPPORTS=THREADS SUPPORTS=GEOS SUPPORTS=POINT_Z_M INPUT=JPEG
INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE

The only difference on Ubuntu I have SUPPORTS=RSVG instead of SUPPORTS=SVGCAIRO. SVG symbols were made by Inkscape and saved as Plain SVG. Symbols opened by FireFox on Windows look OK. Here is a simple SVG file:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:cc="http://creativecommons.org/ns#"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns="http://www.w3.org/2000/svg"
   version="1.1"
   id="svg2"
   viewBox="0 0 180 180"
   height="180"
   width="180">
  <defs
     id="defs4" />
  <metadata
     id="metadata7">
    <rdf:RDF>
      <cc:Work
         rdf:about="">
        <dc:format>image/svg+xml</dc:format>
        <dc:type
           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
        <dc:title></dc:title>
      </cc:Work>
    </rdf:RDF>
  </metadata>
  <g
     transform="translate(0,-872.36214)"
     id="layer1">
    <path
       transform="translate(0,872.36214)"
       id="path4144"
       d="m 82.285714,179.11476 c -0.982143,-0.14417 -4.196428,-0.61435 -7.142857,-1.04486 -7.668726,-1.12049 -17.827119,-4.51697 -25.982328,-8.68726 C 19.364974,154.14624 0.85714283,123.86576 0.85714283,90.35395 0.85714283,66.478971 8.9224485,45.858041 24.90582,28.867618 41.99479,10.701936 64.624359,0.85836043 89.428571,0.80103829 108.64989,0.75661829 124.28979,5.4729666 140.1904,16.108706 c 32.53115,21.759735 46.92422,63.414537 34.90397,101.015144 -4.43994,13.88862 -11.65498,25.67953 -22.05117,36.03633 -15.46643,15.40781 -34.36862,24.09937 -56.650343,26.04881 l -5.535714,0.48432 0,-4.59807 0,-4.59807 6.25,-0.42234 c 12.404687,-0.83824 27.313777,-6.07942 38.068117,-13.38254 5.85601,-3.97675 14.8594,-12.61031 19.30595,-18.51295 6.88492,-9.13948 12.46443,-21.85564 14.64848,-33.38506 1.3951,-7.364673 1.56565,-21.292808 0.34385,-28.079994 -4.05648,-22.53388 -17.01335,-42.086973 -36.04436,-54.394206 -7.54287,-4.877928 -14.44862,-7.891949 -23.94792,-10.452104 -6.15588,-1.659072 -8.12164,-1.843227 -19.695546,-1.845115 -11.811185,-0.0019 -13.438228,0.15735 -20,1.957874 C 24.080593,24.522034 -1.3071113,71.968793 13.93622,116.35714 c 10.160559,29.5874 38.020719,51.41021 68.528066,53.67791 l 6.25,0.46459 0,4.53589 0,4.5359 -2.321429,-0.0973 c -1.276786,-0.0535 -3.125,-0.21523 -4.107143,-0.3594 z"
       style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.71428573;stroke-miterlimit:0;stroke-dasharray:none;stroke-opacity:1" />
    <rect
       y="872.36212"
       x="85"
       height="180"
       width="10"
       id="rect4149"
       style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-miterlimit:0;stroke-dasharray:none;stroke-opacity:1" />
  </g>
</svg>

There is a separate symbolset file with SVG and MapServer vector symbols.

Should I change something in the SVG file for SVGCAIRO? Or any other tipps?

1 Answer 1

2

Are you sure that you have correct paths for your symbolset and svg file? I am getting the same error than you if I write a mapfile that tries to use a non-existing SVG file.

With correct paths this works for me:

MapServer version 7.0.6 (MS4W 3.2.2) OUTPUT=PNG OUTPUT=JPEG OUTPUT=KML
SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=CAIRO 
SUPPORTS=SVG_SYMBOLS SUPPORTS=SVGCAIRO SUPPORTS=ICONV SUPPORTS=FRIBIDI 
SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER 
SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=SOS_SERVER 
SUPPORTS=FASTCGI SUPPORTS=THREADS SUPPORTS=GEOS SUPPORTS=POINT_Z_M 
INPUT=JPEG INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE

I copy-pasted your svg and saved it into a file. In the mapfile I used

SYMBOL
    NAME 'svg'
    TYPE svg
    image 'c:\ms4w\apps\svg_symbol.svg'
END

My layer is

LAYER
 name "pointshp"
 type POINT
 status ON
 DATA "c:\ms4w\apps\symboldata"
  CLASS
       NAME "myLayerName"
       STYLE
         SYMBOL "svg"
       END
  END
END

and the result is

enter image description here

3
  • The problem is the path to the SVG file, it works only if full path with drive letter is given. Please @user30184 try to remove C: from path to prove my idea. It may be a bug...
    – Zoltan
    Commented Jan 4, 2018 at 21:47
  • On Windows I suppose that the drive letter is a part of the absolute path. Without drive letter it is a relative path and then the rule is File paths may be given as absolute paths, or as paths relative to the location of the mapfile. In addition, data files may be specified relative to the SHAPEPATH mapserver.org/mapfile/index.html
    – user30184
    Commented Jan 4, 2018 at 22:09
  • Confirmed that the path can be either an absolute path with driver letter and all, or a path that is relative to the location of the mapfile. I would say it is not a bug but documentation could include the same hint than SYMBOLSET SYMBOLSET [filename] Filename of the symbolset to use. Can be a path relative to the mapfile, or a full path.
    – user30184
    Commented Jan 5, 2018 at 11:08

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.