W3C home > Mailing lists > Public > www-svg@w3.org > January 2016

A tag to build a shape from multiple paths

From: Dominus Carnufex <carnuficina@gmail.com>
Date: Sat, 23 Jan 2016 14:59:08 +0100
Message-ID: <CA+JozGw9nJY8sQQwB8jSHqxoUFVayoZLM1eHtk8BaReHEr3-SQ@mail.gmail.com>
To: www-svg@w3.org
Hello people,

I know it is extremely late in your schedule for SVG 2 to make a
suggestion, but I only recently came across a severe limitation of SVG,
which I would enjoy being addressed in the new standard.

As of yet, paths and polylines are treated not as lines, but as surfaces
enclosed by the said line (and possibly an implicit last stroke to close
the shape). Which means that a group of paths/polylines, together enclosing
a zone, do NOT actually enclose the whole surface when being treated by
SVG. See joined file for an example of what I mean.

My suggestion would be to offer an additional tag, maybe something like
<shape></shape>, that would contain polylines and paths, each of those
being either an outer or inner boundary of the whole shape (using an
attribute, or <inner> / <outer> subtags). This whole shape could in turn be
treated as any other shape, being filled, serving as clip-path, and so on.

What I am describing is actually extremely similar to multipolygon
relations used by OpenStreetMap (
http://wiki.openstreetmap.org/wiki/Relation:multipolygon), which could give
you a basis for reflection, as the OSM format is also an XML derivative.

Why add such a feature? might you ask. Firstly, because it would offer a
much simpler way to create donut-like shapes than dealing with
nonzero/evenodd and the direction of the path used.

Secondly, in order to considerably simplify the creation of complex maps in
SVG, such as this one:
https://commons.wikimedia.org/wiki/File:France_maximale.svg The map
represents the “départements” of France.

Each colored surface is a path filled with that color, although the
boundaries between departments are common, and the colored regions (not
visible here, but present in the SVG) are different paths, although regions
are nothing more than groups of departments, and the coastline is again
another path, which in turn is not the same path as the the international

And there is no simpler way to do it as of yet! Not only would such a
feature make SVG maps simpler, but also lighter: the whole code would be
around half as long if only we could share boundaries between different

Thirdly, speaking of OSM, such a multipolygon feature, together with the
approved “smooth curves” proposal (
would make it extremely simple to rasterize OSM maps directly in SVG,
offering better graphical quality, more accessible maps for the whole of

I hope this proposal will be met with enthusiasm, and bid you my farewell.


(image/svg+xml attachment: clippaths.svg)

Received on Saturday, 23 January 2016 17:10:50 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 March 2017 09:47:43 UTC