
I have found that some multipolygons use nested inner polygons. Example: * A forest (outer) with a lake (inner) that has an island (inner) which is not a forest. (example: http://www.openstreetmap.org/browse/relation/331402)
By definition of the multipolygon relation (http://wiki.openstreetmap.org/wiki/Relation:multipolygon) one has to create two mps. But I see that it is a nice simplification lots of mappers are using.
Attached patch handles this situation. The inner and outer roles are now used as follows: * the outmost polygon must have role=outer (or role=<empty>) * all outmost polygons with role=inner are not used (a warning is issued) * all inside polygons with role=inner use their own tagging * all inside polygons with role=outer use the mp tagging if available or their own tagging if the mp is not tagged * all inside polygons with role=<empty> are categorized automatically as outer/inner depending on the nest level * all inside polygons with role=outer without a direct ambient inner polygon are dropped with a warning message (outer in outer polygon)
Most of the renderers do not support inner in inner polygons but I think it is a very reasonable extension of the multipolygon handling.
This patch also improves the error messages. I haven't seen any more "are not processed due to an unknown reason" messages and I look forward that the community will also not be able to generate any more ... ;-)
WanMil
There have been different opinions about this patch.
There is one controversal point: Should mkgmap allow nested inner polygons?
From my point of view: YES. Because it does not harm in any way. The nested inner polygons I analysed were all reasonable. Ok, they are not 100% compliant to the specification but this is common to lots of others things in (anarchic) OSM.
At the moment I see two possible changes: 1. Issue a warning for any nested inner polygon but process it anyhow. 2. Reject nested inner polygons (and issue a warning). What a pity but they are not 100% compliant.
Please let me know what's the opinion of mkgmap community and committers because I want the improvements of error messages to be committed.
WanMil
The patch improves the handling of roles and warning messages in multipolygon. - A reasonable warning message for nested outer and nested inner polygons is given - nested inner polygons are processed anyhow WanMil