osmconvert does not keep all dependencies of a relation

Dear Open Street Map Community,

I’m just getting into the topic and have a question regarding the command line tool osmconvert.

I have a problem with the following command:

osmconvert map.o5m -v -b=lon1,lat1,lon2,lat2 --complete-multipolygons --complete-boundaries -o=cropped_map.o5m

When I do this for a region with relations consisting of multiple ways, ways that are out of the specified boundaries are deleted, even if they are used in a relation which partly lies within the boundaries. Is there a way to force the tool to include all the dependencies of relations? I thought this is what complete multipolygons is for.

If there is no possibilty to do this with this tool maybe there is another way to achieve what I want to do, which is:

Import areas of osm maps into matlab. For processing in Matlab I need to split the whole map into smaller pieces with some other program I can controll via Matlab.

Thanks in advance.

Best regards,

In order to provide a better understanding of the problem I produced the image below.

The same issue also occurs if I use the “splitter” tool from https://wiki.openstreetmap.org/wiki/Mkgmap/help/splitter

EDIT: The rectangle indicates the bounding box passed to the programs. As you can see in the lower left corner the green are (landuse forest) is not correct because ways lying outside the bounding box are not present although they are part of a relation which is partly inside the bounding box.

EDIT: The tool osmosis is able to apply boundaries and keep dependencies intact. It’s a little bit slower but can export multiple files / apply different boundaries in one go without much increased processing time.