[postgis-tickets] [PostGIS] #2638: geography ST_Intersects bugginess with Polygon/multilinestring M

PostGIS trac at osgeo.org
Thu Feb 6 20:36:07 PST 2014


#2638: geography ST_Intersects bugginess with Polygon/multilinestring M
---------------------+------------------------------------------------------
 Reporter:  robe     |       Owner:  pramsey      
     Type:  defect   |      Status:  new          
 Priority:  medium   |   Milestone:  PostGIS 2.0.5
Component:  postgis  |     Version:  2.1.x        
 Keywords:           |  
---------------------+------------------------------------------------------

Comment(by robe):

 I just realized something -- I wasn't testing dist_unc_g2_g1.  That one
 seems to be always consistently the larger number though the g1_g2 changes
 back and forth between 0 and non-zero.


 {{{
 SELECT ST_Intersects(geog1, geog2) As g1_in_g2, ST_Intersects(geog2,geog1)
 As g2_in_g1
  , _ST_DistanceUncached(geog1,geog2) As dist_unc_g1_g2
  , _ST_DistanceUncached(geog1,geog2) As dist_unc_g2_g1
  , _ST_DistanceTree(geog1,geog2) As dtree_g1_g2
  , _ST_DistanceTree(geog2,geog1) As dtree_g2_g1
 FROM ST_GeogFromText('MULTILINESTRING M ((-71.0821 50.3036 1,50 -71
 1),(-56.0821 50.3036 1,50 -56 1),(-41.0821 50.3036 1,50 -41 1),(-26.0821
 50.3036 1,50 -26 1),(-11.0821 50.3036 1,50 -11 1),(3.9179 50.3036 1,50 4
 1),(18.9179 50.3036 1,50 19 1),(33.9179 50.3036 1,50 34 1),(48.9179
 50.3036 1,50 49 1),(-71.0821 50.3036 2,50 -71 2),(-56.0821 50.3036 2,50
 -56 2),(-41.0821 50.3036 2,50 -41 2),(-26.0821 50.3036 2,50 -26
 2),(-11.0821 50.3036 2,50 -11 2),(3.9179 50.3036 2,50 4 2),(18.9179
 50.3036 2,50 19 2),(33.9179 50.3036 2,50 34 2),(48.9179 50.3036 2,50 49
 2))') As geog1,
 ST_GeogFromText('MULTIPOLYGON M (((0 0 2,10 0 1,10 10 -2,0 10 -5,0 0
 -5),(5 5 6,7 5 6,7 7 6,5 7 10,5 5 -2)))') As geog2;

 g1_in_g2 | g2_in_g1 | dist_unc_g1_g2 |  dist_unc_g2_g1  | dtree_g1_g2 |
 dtree_g_g1
 ---------+----------+----------------+------------------+-------------+------------
 t        | f        |              0 | 184534.350787176 |           0 |

 }}}


 Is it possible you have some assumption in your 2.1 code that
 ST_Distance(g1,g2) = ST_Distance(g2,g1)  (so you are arbitrarily choosing
 one to check )

 That would explain the flipflopping.  Note the 2.0.4 is wrong but it is
 always consistently wrong (for distance where as ST_Intersects  it seems
 to be treating g1 xg2 different from g2 x g1 (which is BIZARRE when the
 distance is always the higher) and ST_Intersects is just short circuit for


 {{{
 SELECT $1 && $2 AND _ST_Distance($1, $2, 0.0, false) < 0.00001
 }}}


 so how on earth can that ever be true when the distance it returns is
 never 0.  Might be having same behavior but just seeing it less often in
 2.0.4 because of some other counter balancing.

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/2638#comment:6>
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