When the geometry crosses the antimeridian, the MBR is not well defined.
In such cases, we make the best possible guess about where the geometry is crossing the meridian line.
In the case of your multi-line, the line does not really cross the meridian line. It has two line segments that are on either
side of the meridian line. So the MBR returned by Spatial is a valid result for this case.
If the line actually crosses the meridian, we know it is supposed to cross the meridian and the expected result is returned.
Thanks Siva. Can you suggest a work around then? For example, is there a command that will join the segments of a multilinestring into a single line so I can calc the MBR on it? The only workable solution I've come up with is to programatically create a MBR on each of the segments and then union them.
You can treat the geometry as a single line instead of a multi-line and call the sdo_mbr function.
For that, you need to do something like this:
sdo_elem_info_array(1,2,1), b.geom.sdo_ordinates))) from (
MDSYS.SDO_GEOMETRY('MULTILINESTRING((178 0, 179.99 1), (-179.99 1, -178 2))',
8307) geom from dual ) b;
Thanks Siva, that's a great idea.