Openstreetmap-carto: Convert patterns to SVG

Created on 16 Feb 2016  路  13Comments  路  Source: gravitystorm/openstreetmap-carto

This will require Mapnik 3, but we want to move these PNGs to vectors for better high-resolution support.

Landuses:

  • [ ] bare_ground
  • [ ] bog
  • [x] forest (#2682)
  • [ ] mangrove
  • [ ] marsh
  • [ ] plant_nursery (#2685)
  • [x] quarry (#2683)
  • [ ] reed
  • [ ] rock
  • [ ] scree
  • [x] scrub (#2684)
  • [ ] swamp
  • [ ] wetland

Cemeteries:

  • [x] christian (#2718)
  • [x] jewish (#2715)
  • [x] generic (#2716)

Lines:

  • [x] cliff (#2628)
  • [x] embankment (#2628)
enhancement landcover pattern

All 13 comments

We could start doing it now, as the software update on servers is ready, but that would break all the other systems still using Mapnik 2. We need a roadmap first - see https://github.com/gravitystorm/openstreetmap-carto/issues/2198.

I think of this ticket as meta-issue, because each pattern requires separate PR probably. I'm not sure how to count them, because some of them are combined, but let's start with this list:

If you add the checkbox list to the first post the "ready count" will be displayed on many places here.

I can do it if Paul has noting against it, but first I wanted to know if I get this list right.

In my eyes the line patterns (cliff/embankment) are much more important to move the SVG since they will actually profit from this in terms of normal rendering results.

For the area patterns i would before all put

  • [ ] check if there are any serious performance implications of moving to SVG patterns, especially if the SVGs are fairly large

check if there are any serious performance implications of moving to SVG patterns, especially if the SVGs are fairly large

Mapnik converts SVGs to images as a one time operation for icons and caches the result. I expect it does the same for SVGs as patterns.

BTW: do we have any other line patterns except those two (cliff and embankment)? We should add all of them to the checklist and check/strike them later.

As I'm developing the new PR for rendering aretes and ridges (sorry for the delay BTW, I have limited spare time), I'd like to know whether I can keep the already available PNG icons or I necessarily need to convert them to SVG, thanks.

@kocio-pl - https://github.com/gravitystorm/openstreetmap-carto/search?utf8=%E2%9C%93&q=line-pattern-file

@Ircama - creating them as SVG would be highly advisable because it gives you better control and adjustability and leads to more consistent results. But it is not a big deal in my opinion - if you have a draft as PNG that works nicely it should not be too difficult to translate that concept into a vector design but if you end up re-designing your current drafts anyway it would make sense not to invest into pixel painting it.

I have looked into the problem with using jsdotpattern generated SVGs and it seems Mapnik is just extremely limited in the SVG functionality it understands. Not only <use> is unsupported, nested groups with transforms are apparently not correctly interpreted either.

I have added a script to the jsdotpattern repository (https://github.com/imagico/jsdotpattern/blob/master/svg_pattern.sh) that uses inkscape to sanitize jsdotpattern generated SVGs to be compatible with Mapnik by flattening + clipping the whole content and converting it to a single path.

Note inkscape can be fairly slow with that, the uncloning step on a complex non-inlined pattern can take several minutes.

The script also has a third optional parameter that allows clipping the pattern to a strip in y-direction which will allow using it as a line pattern which might be useful for example in #110.

Any progress here? Is mapnik still the limiting component?

It has to be tested, some description of the problem is here: https://github.com/gravitystorm/openstreetmap-carto/pull/2727#issuecomment-322042825 and here: #2750.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MarkusStue picture MarkusStue  路  4Comments

boothym picture boothym  路  5Comments

HolgerJeromin picture HolgerJeromin  路  3Comments

polarbearing picture polarbearing  路  5Comments

wielandb picture wielandb  路  3Comments