[postgis-tickets] [PostGIS] #3511: ST_Intersects returns false positives at equator and anti/prime meridian

PostGIS trac at osgeo.org
Tue Mar 22 12:18:49 PDT 2016


#3511: ST_Intersects returns false positives at equator and anti/prime meridian
---------------------------+--------------------------------
 Reporter:  jgm1972        |      Owner:  pramsey
     Type:  defect         |     Status:  new
 Priority:  medium         |  Milestone:  PostGIS PostgreSQL
Component:  postgis        |    Version:  2.2.x
 Keywords:  ST_Intersects  |
---------------------------+--------------------------------
 Using PGAdmin3 v1.22.0 and the Postres App version 9.5.0.0 on a MacBook
 running OSX 10.11.3, ST_Intersects returns false positives when
 intersecting two lines.


 When running an intersection with the anitmeridian, if the second line
 contains a vertex at longitude 0 and any vertex > longitude 90 or < -90,
 the intersection returns true.  For example,


 SELECT ST_Intersects(line, line2) as inter from
 ST_GeogFromText('LINESTRING(180 -90, 180 0, 180 90)') As line,
 ST_GeogFromText('LineString (90.1 1, 0 0.1, -90 -1)') as line2;

 and

 SELECT ST_Intersects(line, line2) as inter from
 ST_GeogFromText('LINESTRING(180 -90, 180 0, 180 90)') As line,
 ST_GeogFromText('LineString (90 1, 0 0.1, -90.1 -1)') as line2;

 return true, but

 SELECT ST_Intersects(line, line2) as inter from
 ST_GeogFromText('LINESTRING(180 -90, 180 0, 180 90)') As line,
 ST_GeogFromText('LineString (90 1, 0 0.1, -90 -1)') as line2;

 and

 SELECT ST_Intersects(line, line2) as inter from
 ST_GeogFromText('LINESTRING(180 -90, 180 0, 180 90)') As line,
 ST_GeogFromText('LineString (90 1, 0 0, -90 -1)') as line2;

 return false.



 Additionally, if the end vertices of the line are on the equator  and >
 longitude 90 or < -90  ST_intersects returns true if the line has another
 vertex with latitude or longitude 0 .

 For example,


 SELECT ST_Intersects(line, line2) as inter from
 ST_GeogFromText('LINESTRING(180 -90, 180 0, 180 90)') As line,
 ST_GeogFromText('LineString (90 0, 0.1 0, -90.1 0)') as line2;

 and

 SELECT ST_Intersects(line, line2) as inter from
 ST_GeogFromText('LINESTRING(180 -90, 180 0, 180 90)') As line,
 ST_GeogFromText('LineString (90 0, 0 0.1, -90.1 0)') as line2;


 return true, but

 SELECT ST_Intersects(line, line2) as inter from
 ST_GeogFromText('LINESTRING(180 -90, 180 0, 180 90)') As line,
 ST_GeogFromText('LineString (90 0, 0.1 0, -90 0)') as line2;

 and

 SELECT ST_Intersects(line, line2) as inter from
 ST_GeogFromText('LINESTRING(180 -90, 180 0, 180 90)') As line,
 ST_GeogFromText('LineString (90 0, 0 0.1, -90 0)') as line2;

 and

 SELECT ST_Intersects(line, line2) as inter from
 ST_GeogFromText('LINESTRING(180 -90, 180 0, 180 90)') As line,
 ST_GeogFromText('LineString (90 0, 0 0, -90 0)') as line2;

 return false.

--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/3511>
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