In CartoCSS you can specify an SVG pattern fill for a polygon as so:

#layer {
    polygon-pattern-file: url(images/fill.svg);

However, the size of the fill is too big at small scales and too small at large scales, and I would like to apply a custom transform to the fill to ensure that it scales properly. Looking at the documentation for polygon-pattern it appears that you can only change the scaling of the polygon being filled, not the actual fill itself.

Is there a way to apply a custom scale to SVG pattern fills? Essentially, it is applying an SVG transform=scale() to the main group of the SVG and changing the root element's height and width.


Update: CartoCSS now supports this since version 0.17.

While Mapnik's PolygonPatternSymbolizer should support this since Mapnik 3 CartoCSS does not yet support this property on polygon or line patterns.

An example for Mapnik XML support can be found here or see the related Mapnik issue.

I would suggest opening a feature request at the mapbox/carto repository on GitHub. The mapnik/mapnik-reference repository will also need updating.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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