[postgis-tickets] [PostGIS] #4081: ST_DWithin using spheroid does not calculate distance properly for geography

PostGIS trac at osgeo.org
Tue Jul 24 09:11:44 PDT 2018


#4081: ST_DWithin using spheroid does not calculate distance properly for
geography
----------------------+---------------------------
  Reporter:  amc6     |      Owner:  pramsey
      Type:  defect   |     Status:  new
  Priority:  medium   |  Milestone:  PostGIS 2.4.5
 Component:  postgis  |    Version:  2.4.x
Resolution:           |   Keywords:
----------------------+---------------------------

Comment (by pramsey):

 Hm, so it seems completely contained in the tree distance calculation when
 used with a non-zero tolerance. So the stopping condition code must have
 an issue...
 {{{
 select
 ST_asEWKT(a),
 ST_asEWKT(b),
 pg_typeof(a),
 pg_typeof(b),
 ST_Distance(a, b, true) as dist_true,
 ST_Distance(a, b, false) as dist_false,
 _ST_DistanceTree(a, b, 0, true) as dist_tree_true,
 _ST_DistanceTree(a, b, 0, false) as dist_tree_false,
 _ST_DistanceUnCached(a, b, 0, true) as dist_uncached_true,
 _ST_DistanceUnCached(a, b, 0, false) as dist_uncached_false,
 ST_DWithin(a, b, 111155.5, true) as within_111155_5_true,
 ST_DWithin(a, b, 111155.6, true) as within_111155_6_true,
 ST_DWithin(a, b, 111195.079, false) as within_111195_079_false,
 ST_DWithin(a, b, 111195.08, false) as within_111195_08_false,
 _ST_DWithinUncached(a, b, 110576, true) as within_uncached_110576,
 _ST_DWithinUncached(a, b, 110575, true) as within_uncached_110575,
 _ST_DWithinUncached(a, b, 111195.08, false) as
 within_uncached_111195_08_false,
 _ST_DWithinUncached(a, b, 111195.079, false) as
 within_uncached_111195_079_false
 from (
         select ST_GeogFromText('SRID=4326;POINT(1.0 2.0)') as a,
 ST_GeogFromText('SRID=4326;POINT(1.0 1.0)') as b
 ) as points
 }}}
 I'm surprised that the spheroid/sphere don't both show the problem, but
 maybe it's just an artefact of the particular error, which is probably
 some kind of precision issue we're seeing with just this case. Thanks for
 the very small test case.

-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/4081#comment:2>
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