4 Replies Latest reply: Oct 1, 2013 10:21 AM by jccartwright RSS

    Error with SDO_MBR when crossing the antimeridian

    jccartwright

      Hello All,

       

      we're using Oracle Spatial 11.2 and I notice a strange behavior when calculating the MBR of a multipart line which crosses the antimeridian.

       

      //fails if multipart line and crosses the antimeridian

      select SDO_UTIL.TO_WKTGEOMETRY(

        SDO_GEOM.SDO_MBR(

          MDSYS.SDO_GEOMETRY('MULTILINESTRING((178 0, 179.99 1), (-179.99 1, -178 2))',8307)

        )

      ) from dual;

      //returns POLYGON ((-179.99 0.0, 179.99 0.0, 179.99 2.0, -179.99 2.0, -179.99 0.0)) which is incorrect

       

      //succeeds if simple line and crosses the antimeridian

      select SDO_UTIL.TO_WKTGEOMETRY(

        SDO_GEOM.SDO_MBR(

          MDSYS.SDO_GEOMETRY('LINESTRING(178 0, 179.99 1, -179.99 1, -178 2)',8307)

        )

      ) from dual;

      //returns POLYGON ((178.0 0.0, -178.0 0.0, -178.0 2.0, 178.0 2.0, 178.0 0.0)) which is correct


      //succeeds if multipart line and does not cross the antimeridian

      select SDO_UTIL.TO_WKTGEOMETRY(

          SDO_GEOM.SDO_MBR(

          MDSYS.SDO_GEOMETRY('MULTILINESTRING((-170 0, -160 1), (-150 1, -140 2))', 8307))

      ) from dual;

      // returns POLYGON ((-170.0 0.0, -140.0 0.0, -140.0 2.0, -170.0 2.0, -170.0 0.0))

       

      Any ideas?

       

      Thanks!

       

      --john