[Tilesathome] Extended Multipolygon support

Hermann Kraus herm at scribus.info
Mon Mar 2 22:33:26 GMT 2009


On Sat, 28 Feb 2009 00:08:48 +0100, Frederik Ramm <frederik at remote.org>
wrote:

> Hi,
>
> Frederik Ramm wrote:
>> I'll look at it now.
> Ok, I have some coding style issues ;-)

I've just learned perl to work on osmarender so some things might not be
as nice as possible. But at least everything works (I hope...).


> You chose to introduce a new object type that you bless as
> "multipolygon", but then there are a lot of places where you have to do
> things like
>
>      next if defined($e) and ref($_) ne $e and not ($e eq 'way' and
> ref($_) eq 'multipolygon');
>
> - would it perhaps have been easier to bless the multipolygons as ways
> and, where required, use an extra hash element to distinguish
> multipolygons from ways?

I don't think it would be easier, as this requires changes everywhere a
way is handled.
The best soultion is probably to handle ways and multipolygons with the
same code.
I already noted this in a comment:
# In theory each way could be represented as a multipolygon with the
# following properties:
# - One outer way
# - No inner ways
# - Tags from the original way
# This might be a good future enhancement but requires big changes to
# existing code.

But as the patch is already quite big I didn't want to make even more
changes.

> It has been suggested on the multipolygon page in the Wiki that when you
> have two or more touching inner or outer rings, they should be treated
> as one ring that only includes those edges that are not shared. This is
> for the benefit of backwards compatibility with today's workarounds
> where people draw two "C" shaped areas of wood around a landing. I'm not
> very fond of this concept but maybe it could be implemented.

I wrote this patch, so such ugly constructs are no longer needed and
should be removed from our data. So it is counter-productive to add
support for this "feature". I also would like to see the feature to handle
old style multipolygons removed (inner and outer with the same tags) as  
this
would provide an incentive to change these polygons to the new tagging  
scheme.

Hermann




More information about the Tilesathome mailing list