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

Inconsistent behavior of ST_Touches with a POINT as one of arguments

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.1
    • 10.1.6
    • GIS
    • None
    • 10.1.6-1

    Description

      Polygon and point, line and point

      ST_Touches(POLYGON,POINT) and ST_Touches(LINESTRING,POINT) in some cases return true in 10.0 and PostgreSQL and false in 10.1:

      10.1

      MariaDB [test]> select ST_Touches(ST_LineFromText('LINESTRING(0 0,5 5)'),ST_PointFromText('POINT(0 0)'));
      +-----------------------------------------------------------------------------------+
      | ST_Touches(ST_LineFromText('LINESTRING(0 0,5 5)'),ST_PointFromText('POINT(0 0)')) |
      +-----------------------------------------------------------------------------------+
      |                                                                                 0 |
      +-----------------------------------------------------------------------------------+
      1 row in set (0.00 sec)
       
      MariaDB [test]> select ST_Touches(ST_PolygonFromText('POLYGON((0 0,0 5,5 5,5 0,0 0))'),ST_PointFromText('POINT(0 0)'));
      +-------------------------------------------------------------------------------------------------+
      | ST_Touches(ST_PolygonFromText('POLYGON((0 0,0 5,5 5,5 0,0 0))'),ST_PointFromText('POINT(0 0)')) |
      +-------------------------------------------------------------------------------------------------+
      |                                                                                               0 |
      +-------------------------------------------------------------------------------------------------+
      1 row in set (0.00 sec)

      10.0

      MariaDB [test]> select ST_Touches(ST_LineFromText('LINESTRING(0 0,5 5)'),ST_PointFromText('POINT(0 0)'));
      +-----------------------------------------------------------------------------------+
      | ST_Touches(ST_LineFromText('LINESTRING(0 0,5 5)'),ST_PointFromText('POINT(0 0)')) |
      +-----------------------------------------------------------------------------------+
      |                                                                                 1 |
      +-----------------------------------------------------------------------------------+
      1 row in set (0.00 sec)
       
      MariaDB [test]> select ST_Touches(ST_PolygonFromText('POLYGON((0 0,0 5,5 5,5 0,0 0))'),ST_PointFromText('POINT(0 0)'));
      +-------------------------------------------------------------------------------------------------+
      | ST_Touches(ST_PolygonFromText('POLYGON((0 0,0 5,5 5,5 0,0 0))'),ST_PointFromText('POINT(0 0)')) |
      +-------------------------------------------------------------------------------------------------+
      |                                                                                               1 |
      +-------------------------------------------------------------------------------------------------+
      1 row in set (0.00 sec)

      PostgreSQL

      pgis=# select ST_Touches(ST_LineFromText('LINESTRING(0 0,5 5)'),ST_PointFromText('POINT(0 0)'));
       st_touches 
      ------------
       t
      (1 row)
       
      pgis=# select ST_Touches(ST_PolygonFromText('POLYGON((0 0,0 5,5 5,5 0,0 0))'),ST_PointFromText('POINT(0 0)'));
       st_touches 
      ------------
       t
      (1 row)

      Two identical points

      ST_Touches(POINT,POINT) returns true in 10.0 and false in 10.1.
      In PostgreSQL, it also returns false. I'm not sure which is correct, the definition of ST_Touches leaves it unclear for a degenerate object such as point.

      10.0

      MariaDB [test]> select ST_Touches(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'));
      +---------------------------------------------------------------------------+
      | ST_Touches(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)')) |
      +---------------------------------------------------------------------------+
      |                                                                         1 |
      +---------------------------------------------------------------------------+
      1 row in set (0.00 sec)

      10.1

      MariaDB [test]> select ST_Touches(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'));
      +---------------------------------------------------------------------------+
      | ST_Touches(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)')) |
      +---------------------------------------------------------------------------+
      |                                                                         0 |
      +---------------------------------------------------------------------------+
      1 row in set (0.00 sec)

      PostgreSQL

      pgis=# select ST_Touches(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'));
       st_touches 
      ------------
       f
      (1 row)

      Attachments

        Issue Links

          Activity

            People

              holyfoot Alexey Botchkov
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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