
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

Rudi escribió:
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 I still could not try your patch, but I would like to know if you think it would solve problem with this multipolygon [1]. It was correctly rendered by mkgmap until OSM migration to 0.6 API. Due to this change, I had to split outer polygon in three parts of less than 2000 nodes each one. Since then it is not rendered by mkgmap. I have also noticed this multipolygon is not correctly rendered by Osmarender [2], but it is by Mapnik, so may be some problem in the data I didn't found. Regards Carlos [1] http://www.openstreetmap.org/browse/relation/128102 [2] http://www.openstreetmap.org/?lat=39.7939395904541&layers=0B00FTF&lon=-6.398...

I still could not try your patch, but I would like to know if you think it would solve problem with this multipolygon [1]. It was correctly rendered by mkgmap until OSM migration to 0.6 API. Due to this change, I had to split outer polygon in three parts of less than 2000 nodes each one. Since then it is not rendered by mkgmap. I have also noticed this multipolygon is not correctly rendered by Osmarender [2], but it is by Mapnik, so may be some problem in the data I didn't found. Regards Carlos [1] http://www.openstreetmap.org/browse/relation/128102 [2] http://www.openstreetmap.org/?lat=39.7939395904541&layers=0B00FTF&lon=-> > 6.39816284179688&zoom=11
This is a special multipolygon: it consists of three outer ways and two inner ways. More than one outer way is currently not supported by mkgmap. I will check what happens in this case and how this problem can be solved. Rudi

Rudi escribió:
I still could not try your patch, but I would like to know if you think it would solve problem with this multipolygon [1]. It was correctly rendered by mkgmap until OSM migration to 0.6 API. Due to this change, I had to split outer polygon in three parts of less than 2000 nodes each one. Since then it is not rendered by mkgmap. I have also noticed this multipolygon is not correctly rendered by Osmarender [2], but it is by Mapnik, so may be some problem in the data I didn't found. Regards Carlos [1] http://www.openstreetmap.org/browse/relation/128102 [2] http://www.openstreetmap.org/?lat=39.7939395904541&layers=0B00FTF&lon=-> >
6.39816284179688&zoom=11
This is a special multipolygon: it consists of three outer ways and two inner ways. More than one outer way is currently not supported by mkgmap. I will check what happens in this case and how this problem can be solved.
OK, thanks. Let us know any advance. Carlos

Hello Carlos, The easiest solution for your problem is to split the water area instead of the outer way. So you should perform the following steps: 1. Join the three outer ways. This works in JOSM (don't try to upload this to API 0.6). 2. Split the water area into several separate parts. 3. Only the area with the islands should be part of the multipolygon relation. 4. Add the third island to the relation (currently it is not a part of it). 5. Copy the tags from the relation to the outer way and to the other areas (mkgmap doesn't use the tags of the relation). See also the wiki page: http://wiki.openstreetmap.org/wiki/Relation:multipolygon Now you have simple areas and simple multipolygons and every renderer should be able to display it correctly. I will also try to improve my patch, so that multiple outer ways are joined if they are parts of a longer way. Rudi
participants (2)
-
Carlos Dávila
-
Rudi