Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-35761

ST_Crosses return true despite the absence of necessary condition.

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 11.7.1
    • 10.6, 10.11, 11.4
    • GIS
    • None

    Description

      As the doc described, the term spatially crosses denotes a spatial relation between two given geometries that has the following properties:
      1.The two geometries intersect
      2.Their intersection results in a geometry that has a dimension that is one less than the maximum dimension of the two given geometries
      3.Their intersection is not equal to either of the two given geometries
      It means, ST_Crosses(A, B) ⇔ ( dim(A ⋂ B) == max( dim(A), dim(B) ) - 1) ∧ (A ⋂ B ≠ A) ∧ (A ⋂ B ≠ B)
      Considering following queries:

      SET @g1 = ST_GeomFromText('MULTILINESTRING((28 99,2 10), (6 36, 62 85, 88 88))');
      SET @g2 = ST_GeomFromText('GEOMETRYCOLLECTION(MULTILINESTRING((28 99,2 10)),LINESTRING(6 36,62 85,42 85,6 36))');
       
      SELECT ST_CROSSES(@g1, @g2), ST_DIMENSION(ST_INTERSECTION(@g1,@g2)), ST_DIMENSION(@g1), ST_DIMENSION(@g2);
      -- result:{t, 1, 1, 1}
      

      dim(@g1 ∩ @g2)= dim(@g1) = dim(@g2) = max(dim(@g1), dim(@g2)) = 1, which does not meet Condition 2. But ST_CROSSES still gives a TRUE result.

      When @ g2 is set as MULTILINESTRING, the result returns 0, which is as expected.

      SET @g1 = ST_GeomFromText('MULTILINESTRING((28 99,2 10), (6 36, 62 85, 88 88))');
      SET @g2 = ST_GeomFromText('MULTILINESTRING((28 99,2 10)),LINESTRING(6 36,62 85,42 85,6 36)');
       
      SELECT ST_CROSSES(@g1, @g2), ST_DIMENSION(ST_INTERSECTION(@g1,@g2)), ST_DIMENSION(@g1), ST_DIMENSION(@g2);
      -- result:{f, 1, 1, 1}
      

      Attachments

        Activity

          People

            Gosselin Dave Gosselin
            nbvfgh Shijie Li
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.