|This page is about the "old" Osmium. For the new version see http://osmcode.org/libosmium .|
Osmium contains code to assemble multipolygons from relations of type=multipolygon and type=boundary into pseudo OSM objects called Areas. This is implemented as a handler that reads nodes, ways, and relations in two passes and creates callbacks for area objects.
Osmium is very clever when assembling the multipolygons. It understands them even if the inner/outer roles are not tagged correctly and if the parts are not in order. It will also (to a certain extent) fix broken geometries such as open or self-intersecting rings. (You can disable fixing of broken geometries if you don't need it.)
The multipolygon handler will create callbacks for all sucessfully assembled multipolygons as well as for all closed ways that are not part of an outer ring of such a multipolygon. This way you get callbacks for all areas that are in OSM, regardless of whether they are encoded as simple polygons in closed ways or more complex multipolygon relations. This will also handle cases properly where a hole inside a multipolygon is another valid object (think of a lake inside a forest).
The Simple Features definition for geometries does not allow touching inner rings in a multipolygon. But because this is quite a common case in OSM (think of a forest with a lake and touching meadow inside) Osmium does handle this case and will create proper multipolygons.
To use the multipolygon assembly you have to compile Osmium with the GEOS library, use -DOSMIUM_WITH_GEOS.