# Multipolygon Examples

## Examples for mappers: Step-by-step from a simple to a complex one

In this chapter a simple example is extended step-by step to a complex one.

 Style used to describe the examples: Ways are marked with arabic numerals 1, 2, 3 .... Unclosed ways are marked with large black dots at their ends. Areas are marked with capital letters A, B, C, .... The numbers and letters in the figures are followed by the tags for the object (way or area) to make the figures rather self-explanatory. Only for the example essential tags are given. Tags which aren't essential for the examples are omitted. E.g. name=*, source=*. The relations are described in the text in list form making them more readable than XML notation. New members added in the current step to the relation are marked >italic. ```Relation Tag for Relation ... Member of Relation >New member of Relation ... ``` Style used)

### Forest (One closed way)

 Closed way 1 is drawn and tagged with landuse=forest describing forest A. Tagging a closed way with a tag indicating an area results in drawing an area. This kind of shortcut works for simple areas the outline of which consists of one single way, and which do not have holes. The same could be done with a multipolygon but this would just complicate a simple case. Forest (One closed way)

### Forest with lake (One outer and one inner ring)

 Closed way 2 is added within forest A and tagged with natural=water describing lake B. Closed way 1 is now untagged because there are no map features for the whole enclosed area. It doesn't represent something on its own. Forest A which is tagged with landuse=forest is the green ring: the area enclosed by way 1 minus the lake B. Multipolygon A describes the case. ```Relation A: type=multipolygon landuse=forest outer 1 inner 2 ``` Forest with lake (One outer and one inner ring)

### Forest with two lakes (One outer and two inner rings)

 Closed way 3 is added within forest A and tagged with natural=water describing lake C. Forest A which is tagged with landuse=forest isn't a simple ring anymore. It's now the area enclosed by way 1 minus lakes B and C. inner 3 is added to multipolygon A: ```Relation A: type=multipolygon landuse=forest outer 1 inner 2 >inner 3 ``` Forest with two lakes (One outer and two inner rings)

### Forest with two lakes and an island (Nested multipolygons)

 Closed way 4 is added within lake B and tagged with natural=scrub describing island D. Forest A and thus multipolygon A stay unchanged: ```Relation A: type=multipolygon landuse=forest outer 1 inner 2 inner 3 ``` Closed way 2 is now also untagged because there are no map features for the whole enclosed area anymore. Lake B which is tagged with natural=water is now the blue ring: the area enclosed by way 2 minus the island D. This is described by a second multipolygon B: ```Relation B: type=multipolygon natural=water outer 2 inner 4 ``` Forest with two lakes and an island (Nested multipolygons)

### Forest with 2 lakes, island, boundary and highway (Multiple ways forming nested multipolygons)

 Way 1 used to be the whole boundary of forest A now gets split and partially replaced: The linear ways 5, 6, 7 and 8 are added and tagged with boundary=administrative. Further the linear ways 9, 10 and 11 are added and tagged with highway=unclassified. Remark: the usage of highways (linear element) as boundaries (multipolygon or not) for landuse (area element) is basically discouraged. This because later shifting, nudging or reshaping the highway or area immediately results in the not often intended change of the connected area resp. highway. More importantly the vast majority of (less technical) mappers cannot be expected to ever grasp advanced multipolygons. Overusing advanced multipolygons like in this example will either prevent those mappers from participating or down the road guarantee the destruction of these multipolygons. Also note that including highways in advanced multipolygons like in this example, vastly complicates later editing of those highways (physical modifications to roads happen all the time). Far from all mappers can be expected to have the skills or time to handle this gracefully. Way 2 used to be the whole boundary of lake B is also split. The ways 12, 13, 14 and 15 are added and tagged with highway=track. There are own map features for ways 5 to 15 and thus they are tagged with them regardless whether they are members of multipolygons because they aren't areas. The "remaining" way 1 and the ways 6 and 10 are now forming the boundary of forest A. outer 6, outer 10 and inner 13 are added to multipolygon A: ```Relation A: type=multipolygon landuse=forest outer 1 >outer 6 >outer 10 inner 2 >inner 13 inner 3 ``` The ways 2 and 13 are forming the boundary of lake B. outer 13 is added to multipolygon B: ```Relation B: type=multipolygon natural=water outer 2 >outer 13 inner 4 ``` Forest with 2 lakes, island, boundary and highway (Multiple ways forming nested multipolygons)

Remarks:

• When a highway is chosen as boundary of an area then the roadside and not the (imaginary) center line of the road is the boundary.
• Some mappers prefer to use ways as boundaries of areas as in this example, some prefer drawing separate lines and some use both depending on the situation.
• This sequence of examples started with areas. In practise it's more likely to have linear features like highways before areas are added.

 The former way 1 gets split again into a new short way 1 and a new way 16 which is tagged with barrier=fence. Way 17 is added and tagged with barrier=fence. Way 18 is added and not tagged. Ways 7, 16, 17 and 18 are forming the boundary of farmland E which is adjacent to forest A. They share the way 16. Closed way 19 is added inside farmland E and tagged with landuse=farmyard describing farmyard G. Closed way 20 is added by using the two northern nodes of way 19 and drawing a duplicate way on top of the northern boundary of farmyard G. Way 20 is tagged with natural=water describing a third lake F. outer 16 is added to multipolygon A: ```Relation A: type=multipolygon landuse=forest outer 1 >outer 16 outer 6 outer 10 inner 2 inner 13 inner 3 ``` Multipolygon B stays unchanged: ```Relation B: type=multipolygon natural=water outer 2 outer 13 inner 4 ``` Farmland E is described by a new multipolygon E: ```Relation E: type=multipolygon landuse=farmland outer 7 outer 16 outer 17 outer 18 inner 19 inner 20 ``` Farmland adjacent to forest and farmyard adjacent to lake

Remarks:

• Duplicate ways, i.e. ways on top of each other, are acceptable, duplicate nodes, i.e. nodes on each other, not.
• Duplicate ways can be avoided by using multipolygons. But in this example it would just complicate a simple case.

### Three separated farmland (Disjunct outer rings)

 Way 21 is added and not tagged. Way 22 is added and tagged with barrier=fence. Way 21 and 22 are forming farmland E2 which is separated from but belongs to farmland E. Way 23 is added and not tagged. Way 24 is added and tagged with barrier=fence. Way 23 and 24 are forming farmland E3 which is separated from but belongs to farmland E. Closed way 25 is added within farmland E3 and tagged with natural=water describing lake H. Multipolygon A stays unchanged: ```Relation A: type=multipolygon landuse=forest outer 1 outer 16 outer 6 outer 10 inner 2 inner 13 inner 3 ``` Multipolygon B stays unchanged: ```Relation B: type=multipolygon natural=water outer 2 outer 13 inner 4 ``` outer 21, outer 22, outer 23, outer 24 and inner 25 are added to multipolygon E: ```Relation E: type=multipolygon landuse=farmland outer 7 outer 16 outer 17 outer 18 inner 19 inner 20 >outer 21 >outer 22 >outer 23 >outer 24 >inner 25 ``` Three separated farmland (Disjunct outer rings)

## Examples for mappers

### Meadow with farmland with two forest with scrub (Polygons nested 4 levels)

Rule: When polygons are nested over several levels it's the safest way to

• tag only the most inner closed ways with tags describing an area and
• tag the other closed ways only in such a way that no area is described and
• use multiple multipolygons each describing two adjacent levels.

This example originated from the discussion Verschachtelte Multipolygone in the forum Germany.

 Closed ways 1 and 2 enclose areas with holes. Thus multipolygons are needed and the ways aren't tagged. Ways 3 and 4 as well as 5 and 6 are multiple ways enclosing areas. Thus multipolygons are needed. Ways 3 and 6 are tagged with their own map features. Ways 4 and 5 have no map features and thus are untagged. Closed way 7 doesn't have holes and it is tagged with a map feature which describes an area. Thus no multipolygon is needed. Multipolygon A describes the meadow A, multipolygon B the farmland B, multipolygon C the forest C and multipolygon D the forest D: ```Relation A: type=multipolygon landuse=meadow outer 1 inner 2 Relation B: type=multipolygon landuse=farmland outer 2 inner 3 inner 4 inner 5 inner 6 Relation C: type=multipolygon landuse=forest outer 3 outer 4 Relation D: type=multipolygon landuse=forest outer 5 outer 6 inner 7 ``` Meadow with farmland with two forest with scrub (Polygons nested 4 levels)

### Forest with three wood

This example originated from the discussion Multipolygone, z.B. See oder Gebäude in Waldfläche in the forum Germany. It demonstrates how current deficiencies of the renderers in processing multipolygons can be circumvented while still tagging correctly according to the reality. No Tagging for the renderer.

Theory:

 A big forest of mixed wood which has three holes with coniferious, deciduous and mixed wood can be described correctly by Relation A in theory. But the renderers including editor JOSM currently don't process it correctly. Closed ways 1, 2, 3 and 4 are tagged as shown in the figure. Way 1 encloses the whole area. ```Relation A: type=multipolygon landuse=forest wood=mixed outer 1 inner 2 inner 3 inner 4 ``` Forest with three wood (Theory)

Practice:

 The following description is correct too, but uses four multipolygons to circumvent the current deficiencies of the renderers. Way 1 and relation A stay unchanged. The tags of the ways 2, 3 and 4 are moved from the ways to new relations B, C, D. ```Relation A: type=multipolygon landuse=forest wood=mixed outer 1 inner 2 inner 3 inner 4 Relation B: type=multipolygon landuse=forest wood=coniferious outer 2 Relation C: type=multipolygon landuse=forest wood=deciduous outer 3 Relation D: type=multipolygon landuse=forest wood=mixed outer 4 ``` Forest with three wood (Practice)