[postgis-tickets] [PostGIS] #4290: bug in Postgis geodetic code impacting distance calculation with geography multipolygon

PostGIS trac at osgeo.org
Fri Jan 11 11:49:57 PST 2019


#4290: bug in Postgis geodetic code impacting distance calculation with geography
multipolygon
---------------------------+---------------------------
  Reporter:  dmkaplan2000  |      Owner:  pramsey
      Type:  defect        |     Status:  new
  Priority:  medium        |  Milestone:  PostGIS 2.5.2
 Component:  postgis       |    Version:  2.4.x
Resolution:                |   Keywords:
---------------------------+---------------------------

Comment (by robe):

 The one I was originally looking at why I was confused is this query in
 which they are both wrong though the t1.gid= 1 and t2.gid = 3 is a subset
 so you'd expect 2.4.3 install to be consistently right or wrong about the
 same inputs unless it's using cached geometry.

 {{{
 SELECT t1.gid AS gid1, t2.gid AS gid2,
        ST_Distance(t1.geom,t2.geom) AS dist_lonlat,
        ST_Distance(ST_Transform(t1.geom,26918),
                    ST_Transform(t2.geom,26918)) AS dist_utm,
        ST_Distance(t1.geom::geography,t2.geom::geography) AS
 dist_geography,
        _ST_DistanceTree(t1.geom::geography,t2.geom::geography) AS
 dist_geography_tree,
        _ST_DistanceUncached(t1.geom::geography,t2.geom::geography) AS
 dist_geography_uncached,
 ST_Distance((ST_Dump(t1.geom)).geom::geography,(ST_Dump(t2.geom)).geom::geography)
 AS dist_geography_dump
 FROM tt t1 JOIN tt t2 ON t1.gid<t2.gid
 WHERE t1.gid=1;
 }}}


 So I think that second failure might be something else as I recall we have
 another ticket somewhere about this second case with sets.


 {{{
  gid1 | gid2 |    dist_lonlat    |     dist_utm     | dist_geography  |
 dist_geography_tree | dist_geography_uncached | dist_geography_dump
 ------+------+-------------------+------------------+-----------------+---------------------+-------------------------+---------------------
     1 |    2 |  1.85730161336142 | 204442.260208712 | 204476.98155351 |
 204476.981553506 |        204476.981553506 |     204476.98155351
     1 |    3 | 0.185028680023504 | 18357.3813638682 |               0 |
 0 |        18358.8660072466 |      18358.86600725
 (2 rows)
 }}}

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