[postgis-tickets] [PostGIS] #4932: Possible Bug with geography ST_Intersects / ST_Distance

PostGIS trac at osgeo.org
Tue Jun 22 07:02:42 PDT 2021


#4932: Possible Bug with geography ST_Intersects / ST_Distance
---------------------+---------------------------
 Reporter:  robe     |      Owner:  pramsey
     Type:  defect   |     Status:  new
 Priority:  medium   |  Milestone:  PostGIS 3.1.3
Component:  postgis  |    Version:  master
 Keywords:           |
---------------------+---------------------------
 Nek on PostGIS noted the documentation for geography ST_Intersects is
 wrong.

 https://postgis.net/docs/ST_Intersects.html

 In the docs it says this should return true


 {{{
 SELECT ST_Intersects(
                 'SRID=4326;LINESTRING(-43.23456 72.4567,-43.23456
 72.4568)'::geography,
                 'SRID=4326;POINT(-43.23456 72.4567772)'::geography
                 );
 }}}

 But it returns false.  I just checked on my PostGIS 3.2 build and it
 indeed returns false.

 However ST_Distance returns 0

 {{{
 SELECT ST_Distance(
                 'SRID=4326;LINESTRING(-43.23456 72.4567,-43.23456
 72.4568)'::geography,
                 'SRID=4326;POINT(-43.23456 72.4567772)'::geography
                 );
 }}}

 Even _ST_DistanceTreet returns 0


 {{{
 SELECT _ST_DistanceTree(
                 'SRID=4326;LINESTRING(-43.23456 72.4567,-43.23456
 72.4568)'::geography,
                 'SRID=4326;POINT(-43.23456 72.4567772)'::geography
                 );
 }}}

 However _ST_DistanceUncached returns a small number, so perhaps that is
 what ST_Intersects is using


 {{{
 SELECT _ST_DistanceUncached(
                 'SRID=4326;LINESTRING(-43.23456 72.4567,-43.23456
 72.4568)'::geography,
                 'SRID=4326;POINT(-43.23456 72.4567772)'::geography
                 );
 }}}

 returns - 1.4148932702941524e-09

 same answer with PostGIS 3.1.2

-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/4932>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list