logo separator

[mkgmap-dev] [PATCH] multipolygon

From Rudi drahtesel42 at web.de on Thu Jul 9 19:05:31 BST 2009

I had several problems with the rendering of multipolygons on my Garmin
Mobile XT. So I made a small patch. See attachment.

Problem 1:
Simple holes in a polygon are rendered correctly, but if the inner polygon
has additional tags then this information is not rendered. In my example
(Chiemsee in Germany) the lake (natural=water) has the role 'outer' and the
islands have the role 'inner' with additional tags (natural=land,
landuse=residential).

Solution:
The points of the inner polygon are no longer deleted. 
(According to the wiki the inner polygon shouldn't have tags in the case of
a simple hole, but in reality this is not always true. I remove identical
tags from the inner polygon, so simple holes are still rendered correctly.)

Problem 2:
Multipolygon within a multipolygon. In my example the island has the role
'inner' and also the role 'outer' of another relation (wood inside the
island). Now I have a problem: The order of the processing of the relations
is not determined. If the lake relation is processed first then everything
is ok. But if the island relation is processed first then the polygon of the
island is changed (polygon is extended by the inner ways) and this has a
negative influence on the lake relation. Now we have water within the island
because the lake polygon is extended by the island way that was extended
before.

Solution:
I duplicate the outer way and remove all tags of the original outer way. The
new outer way is changed (adding the inner ways) but this doesn't influence
other relations because they refer to the original outer way. By removing
the tags of the original way it will never be used by the style.

Problem 3:
Small multipolygons are rendered correctly but I have a problem with larger
multipolygons. The inner holes are visible at low zoom levels, but they
disappear if I zoom in. I don't know if this is a problem of the Garmin
software or if this is an effect of a filter in mkgmap.

Solution:
Nodes with identical coordinates (where the outer way is joined with the
inner way) seem to be the reason. I shift two nodes by one unit, now the
multipolygon is displayed correctly if I zoom in.

To do:
- I am a novice in java programming. A code review is suggested (if the
patch is a candidate for trunk).
- If problem 3 is caused by an mkgmap filter then it would be better to
change the filter instead of moving the nodes.

Rudi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: multipolygon.patch
Type: application/octet-stream
Size: 6268 bytes
Desc: not available
Url : http://lists.mkgmap.org.uk/pipermail/mkgmap-dev/attachments/20090709/cf28cea8/attachment.obj 


More information about the mkgmap-dev mailing list