4 Replies Latest reply: Jun 25, 2012 5:07 PM by rpitts RSS

    sdo_geom.relate determines DISJOINT where CONTAINS expected

    Rene W.
      I get the following behaviour on 10.2.0.5 (win64) and 11.2.0.3 patch7 (win32)

      When creating a buffer around a line element and determining the relation between the buffer and the line I expect to get CONTAINS but I get DISJOINT.

      Here is the test code:
      declare
         l_geo1   mdsys.sdo_geometry;
         l_geo2   mdsys.sdo_geometry;
         l_relate varchar2(100);
      begin
      
         -- Create the line
         l_geo1 := mdsys.sdo_geometry(2002
                                     ,90112
                                     ,null
                                     ,mdsys.sdo_elem_info_array(1, 2, 1)
                                     ,mdsys.sdo_ordinate_array(153972.952, 473287.52, 153972.839, 473281.531));
      
         -- Create the buffer
         l_geo2 := sdo_geom.sdo_buffer(l_geo1, 0.020, 0.0005);
      
         -- Determine the relation
         l_relate := sdo_geom.relate(l_geo2, 'determine', l_geo1, 0.0005);
      
         dbms_output.put_line(l_relate);
      
      end;
      When using buffer size 0 the relation is EQUAL (as expected).
      When using buffer sizes 0.01-0.26 the relation is DISJOINT
      When using buffer size > 0.027 the relation is CONTAINS.

      This behaviour is found in quite a few lines in our dataset. All these lines run in an almost north-south direction.

      Are my expectations about the outcome correct?
      Is the sdo_geom.relate function returning the wrong result?

      thanks, Rene.

      Edited by: Rene W. on Jun 21, 2012 3:57 AM
      Now also tested on latest 11.2.0.3 version

      Edited by: Rene W. on Jun 21, 2012 4:15 AM
      Added a loop for different buffer sizes:

      0 EQUAL
      .001 CONTAINS
      .002 CONTAINS
      .003 CONTAINS
      .004 CONTAINS
      .005 CONTAINS
      .006 DISJOINT
      .007 DISJOINT
      .008 DISJOINT
      .009 DISJOINT
      .01 DISJOINT
      .011 DISJOINT
      .012 DISJOINT
      .013 DISJOINT
      .014 DISJOINT
      .015 DISJOINT
      .016 DISJOINT
      .017 DISJOINT
      .018 DISJOINT
      .019 DISJOINT
      .02 DISJOINT
      .021 DISJOINT
      .022 DISJOINT
      .023 DISJOINT
      .024 DISJOINT
      .025 DISJOINT
      .026 DISJOINT
      .027 CONTAINS
      .028 CONTAINS