Care to share your knowledge about SVG and mapnik?

I have the impression that writing SVG that it’s actually rendered by mapnik is quite hard. Let me show you my latest frustrating failed attempt:

I have my own fork of osm-carto, and I want to render a green hatching pattern on Natural Reserves and National Parks. So I took the patterns/military_red_hatch.svg file, loaded it in InkScape, changed the hatching color from #ff5555 to #55ff55, and saved it as patterns/np_nr_green_hatch.svg.

On the CartoCSS side, I added this code which is also a ‘clone’ of the military red hatch code:

             line-width: 2;
         }
       }
+
+      // ::fill already exists in a previous branch, and seems like either
+      // `carto` and/or mapnik get confused by this
+      ::fill_2 {
+        // polygon-fill: #55ff55;
+        // polygon-opacity: 0.08;
+        polygon-pattern-file: url('patterns/np_nr_green_hatch.svg');
+        polygon-pattern-alignment: global;
+      }
     }
   }
 }

to the #protectted-areas layer. This (of course?) didn’t work. mapnik (actually kosmtik) loads the project fine (and I even compile the thing into MapnikXML to double check), but I get no green hatching. Notice the commented out code; I used this to make sure this is being rendered.

Remembering that InkScape does not always write ‘good SVGs’ (I wish I could point to some discussion mentioning this), I instead openes the original SVG with a text editor, changed the color and saved as above. And it didn’t work either. We’re talking about the same actual contents of the original file with only 4 bytes changed.

Finally, I thought it was a mapnik bug, having a polygon pattern only attachment not rendering, so I instead added the pattern to the ::narrowline attachment:

         [zoom >= 12] {
             line-width: 2;
         }
+
+        polygon-pattern-file: url('patterns/np_nr_green_hatch.svg');
+        polygon-pattern-alignment: global;
       }
     }
   }

This didn’t render either. I have the impression this is not the first time I get frustrated trying to produce SVGs that mapnik accepts and renders. As a last resort, I copied the military file onto the other one and retried. Nothing.

So, is it my SVGs, InkScape, my CartoCSS, mapnik or any combination of those to blame here?

I can’t comment on .svgs (I don’t use them myself, but probably should), but when something doesn’t appear, it normally means that I’ve forgotten to restart apache2 and renderd, or delete cached metatiles below /var, or there 's something cached on the client side.

Assuming it’s none of the above, maybe turn debug on for renderd and check nothing odd in syslog?

I’m not running renderd or Apache. This is development time, so like I mentioned it’s kosmtik + carto + pure mapnik.