[OSM-dev] Advice sought on polygon-with-hole drawing

Jon Burgess jburgess777 at googlemail.com
Thu Mar 13 23:50:12 GMT 2008

On Fri, 2008-03-14 at 00:05 +0100, Frederik Ramm wrote:
> Hi,
>    I'm currently working on a Perl re-implementation of Osmarender. It
> is already almost feature complete; I've made an early announcement on
> the tiles at home list:
> http://lists.openstreetmap.org/pipermail/tilesathome/2008-March/001903.html
> While the program generally aims to be 100% compatible to the XSLT
> implementation (using identical rule files), one thing I want to
> change is the way polygons with holes are drawn. I want to switch from
> the default evenodd rule (that relies on the directions of ways) to
> the nonzero rule, and use it like so (pseudo code, omitting all the
> filtering and layering stuff):
> for each way with area tagging
>    if way is member of multipoly relation
>       if role is "inner"
>          ignore way
>       else
>          combine way and all "inner" members of relation
>          generate drawing instruction for combined path 
>       end
>    else
>       generate drawing instruction for simple path
>    end
> end
> The tags that determine how the way is drawn would always be those of
> the "outer" way. Those of the "inner" way(s) would be completely ignored,
> unless they, in turn, were "outer" ways in another relation (or unless
> a non-area rule would apply to them). Tags on the relation would be
> ignored as well.

>From a pure design perspective the cleanest approach would be (IMO) to
have the tags only on the relation. Otherwise there is always the
possibility for ambiguity in cases where the tags on the outer ways
differ. Yes this is an error, but one which is bound to occur
occasionally. It also enables other use cases like re-using a way along
a border between 2 country polygons.

>From the Mapnik(osm2pgsql) perspective, having the tags on the outer
ways makes it easier for the code to identify that these may be part of
a multipolygon.


More information about the dev mailing list