I tried your 2017 workspace, and was able to reproduce the issue.
Running it in 2019.1 produces the expected result. In the log when running in 2021.1, the mapnik rasterizer reports:
Mapnik LOG> 2022-02-14 14:06:35: SVG PARSING ERROR:"SVG parse error: failed to parse <number> with value "none""
Mapnik is a plugin which may have been upgraded separately to its transformer version, because the dll files in Program Files\FME2021.1\plugins\mapnik are different between versions. The transformer just runs the plugin which comes with the FME version.
It's not the first bug I've encountered in mapnik, is there a way you can create SVG files which it is able to read correctly?
Thanks for the help. I didn't think about the DLL, good point. This is probably the source of the difference.
Is there a way to use the old DLL in a more recent install of FME?
The parsing error isn't really important, this is due to something written in the style of the SVG, it doesn't support "stroke-width: none" but I already tried to change it to "stroke-width: 0" and it doesn't help. The error disappears but the issue is still here.
As I said, the SVG are generated from an Autocad DWG. There are things I can change in the process like dealing with the none stroke. But I can't change the fact that some Autocad symbols are made of multiple entities.
Let's take an example with a particularly bothering symbol:
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-1.25 -1.25 102.5 102.5"><g xmlns:fme="http://www.safe.com/fme" fill="none" stroke="black" stroke-width="0.0125" transform="translate(0,100) scale(1, -1)">
<g id="CAB014">
<path fme:transform="translate(0,0)" fme:autocad_block_name="CAB014" fme:autocad_block_number="232" fme:autocad_entity_handle="C124" style="fill: rgb(0,0,0); stroke: none; stroke-width: 0" d="M 100,50 l -0.190265,4.35779 -0.569347,4.32462 -0.944096,4.25854 -1.31166,4.16005 -1.66924,4.02991 -2.01412,3.86909 -2.34367,3.67882 -2.65538,3.46056 -2.94688,3.21596 -3.21596,2.94688 -3.46056,2.65538 -3.67882,2.34367 -3.86909,2.01412 -4.02991,1.66924 -4.16005,1.31166 -4.25854,0.944096 -4.32462,0.569347 -4.35779,0.190265 -4.35779,-0.190265 -4.32462,-0.569347 -4.25854,-0.944096 -4.16005,-1.31166 -4.02991,-1.66924 -3.86909,-2.01412 -3.67882,-2.34367 -3.46056,-2.65538 -3.21596,-2.94688 -2.94688,-3.21596 -2.65538,-3.46056 -2.34367,-3.67882 -2.01412,-3.86909 -1.66924,-4.02991 -1.31166,-4.16005 -0.944096,-4.25854 -0.569347,-4.32462 -0.190265,-4.35779 0.190265,-4.35779 0.569347,-4.32462 0.944096,-4.25854 1.31166,-4.16005 1.66924,-4.02991 2.01412,-3.86909 2.34367,-3.67882 2.65538,-3.46056 2.94688,-3.21596 3.21596,-2.94688 3.46056,-2.65538 3.67882,-2.34367 3.86909,-2.01412 4.02991,-1.66924 4.16005,-1.31166 4.25854,-0.944096 4.32462,-0.569347 4.35779,-0.190265 4.35779,0.190265 4.32462,0.569347 4.25854,0.944096 4.16005,1.31166 4.02991,1.66924 3.86909,2.01412 3.67882,2.34367 3.46056,2.65538 3.21596,2.94688 2.94688,3.21596 2.65538,3.46056 2.34367,3.67882 2.01412,3.86909 1.66924,4.02991 1.31166,4.16005 0.944096,4.25854 0.569347,4.32462 0.190265,4.35779 z "/>
<ellipse fme:transform="translate(0,0)" fme:autocad_block_name="CAB014" fme:autocad_block_number="232" fme:autocad_entity_handle="C125" style="fill: none; stroke: rgb(0,0,0); stroke-width: 2.5" rx="50" ry="50" transform="translate(50,50) rotate(0.00)"/>
</g></g></svg>
Here this is a simple case, the symbol is a solid circle with an outline stroke. At the origin, the Autocad symbol is made of a hatch and an ellipse, this is why you see two autocad entities mentioned in the SVG. MapnikRasterizer, in the recent version causing the issue, will always ignore the filling of the SVG. In the marker parameter, if I set anything in the fill section, it will be ignored. Anything I set in the line section is performed. Is there an issue with how the symbol is converted to SVG?
I may have found the issue, the first <g> element has a none fill, it is blocking the filling by the transformer:
<g xmlns:fme="http://www.safe.com/fme" fill="none" stroke="black" stroke-width="0.0125" transform="translate(0,100) scale(1, -1)">
Giving it a color manually enable the filling in FME by mapnik.
I will check where it comes from
After a few tries, it seems that this element is entirely made up by FME during the writing. I don't think there is any control on that. It is useless to specify that in the svg to have a empty background and it messes with mapnik rasterizer.
Hi @alexandre thanks to your thorough investigation, I can confirm I'm seeing the same issue. Removing the fill="none" SVG attribute results in a successful output from the MapnikRasterizer.
I'll be looking to file a bug report/enhancement request to resolve this issue in future releases of FME, however I do need just one piece of supporting information. That being the AutoCAD to SVG workspace you used to create the SVG files. Would you be willing to share the Workspace and Source Data for that process with us so that we can fully reproduce this issue? If you're not comfortable sharing the data publicly here, you can also upload the data to our Safe Software Support FTP.
Hi @alexandre thanks to your thorough investigation, I can confirm I'm seeing the same issue. Removing the fill="none" SVG attribute results in a successful output from the MapnikRasterizer.
I'll be looking to file a bug report/enhancement request to resolve this issue in future releases of FME, however I do need just one piece of supporting information. That being the AutoCAD to SVG workspace you used to create the SVG files. Would you be willing to share the Workspace and Source Data for that process with us so that we can fully reproduce this issue? If you're not comfortable sharing the data publicly here, you can also upload the data to our Safe Software Support FTP.
Thanks a lot, here the workbench I use to produce the SVG.
I added the solution I implemented as a python script running at the end.
If it interests someone, it is simply overwriting to remove the issue by brute force:
import os
import fme
directory = fme.macroValuese'cSvgFolderPath']
fileNames = os.listdir(directory)
for f in fileNames:
if f.endswith(".svg"):
filepath=directory+'/'+f
fl=open(filepath).read()
open(filepath, 'w').write(fl.replace('fill="none" ',''))
Thanks a lot, here the workbench I use to produce the SVG.
I added the solution I implemented as a python script running at the end.
If it interests someone, it is simply overwriting to remove the issue by brute force:
import os
import fme
directory = fme.macroValuesm'cSvgFolderPath']
fileNames = os.listdir(directory)
for f in fileNames:
if f.endswith(".svg"):
filepath=directory+'/'+f
fl=open(filepath).read()
open(filepath, 'w').write(fl.replace('fill="none" ',''))
Hi @alexandre
I filed a bug report regarding this issue. For your reference, the issue number is FMEENGINE-72567. If a fix is released in a new version of FME, you will be notified here.
Thanks.