[postgis-devel] [PostGIS] #1625: ST_Within and ST_DWithin disagree

PostGIS trac at osgeo.org
Tue Feb 28 06:28:27 PST 2012


#1625: ST_Within and ST_DWithin disagree
---------------------+------------------------------------------------------
 Reporter:  strk     |       Owner:  pramsey      
     Type:  defect   |      Status:  new          
 Priority:  medium   |   Milestone:  PostGIS 2.0.0
Component:  postgis  |     Version:  trunk        
 Keywords:           |  
---------------------+------------------------------------------------------
 {{{
 =# with inp as ( select
 '010100000070841C1ED7F9204187A97F8DB8AF0141'::geometry as p,
 '010200000002000000B6813B20D7F92041F5807988B8AF014100000000D6F9204133333333BBAF0141'::geometry
 as l
 ) select ST_AsText(l) as l, ST_AsText(p) as p,
   ST_Within(p, l) as within,
   ST_DWithin(p, l, 0) as dwithin
 from inp;
 -[ RECORD 1 ]----------------------------------------------------
 l       | LINESTRING(556267.562954 144887.066638,556267 144887.4)
 p       | POINT(556267.55881132 144887.069091153)
 within  | f
 dwithin | t
 }}}

 I suspect ST_Within is right, but the point was obtained by ClosestPoint
 so is the best we can do to _find_ a point within a line. Having a too-
 precise ST_Within doesn't really help us.

 Maybe we can keep overly-precise ST_Within and use ST_DWithin for
 topology, but worth an opinion by Martin Davis...

 See #1613 for the consequences of this.

-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/1625>
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-devel mailing list