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

Frederik Ramm frederik at remote.org
Thu Mar 13 23:05:49 GMT 2008


   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:


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
         combine way and all "inner" members of relation
         generate drawing instruction for combined path 
      generate drawing instruction for simple path

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.

There are a number of evil cases here, for example if you have a
multipoly relation with intersecting "inner" ways or "inner" ways that
are in fact somewhere on the outside - these will most likely lead to
very strange results but I'm not so worried about that. 

Do you think this would work? I'm a bit unsure about ignoring the tags
on the relation; ideally these should override tags on the outer way,
if specified (or no?). But since nobody supports that anyway at the
moment, I thought we can leave that for later.


Frederik Ramm ## eMail frederik at remote.org ## N49°00.09' E008°23.33'

More information about the dev mailing list