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

PostGIS trac at osgeo.org
Fri Jan 11 11:38:50 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):

 ah nevermind I see what you mean I was looking at the wrong query.

 For completeness:
 -- this query

 {{{
 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_DistanceTree(ST_GeometryN(t1.geom,1), ST_GeometryN(t2.geom,1))
 AS dist_geography_tree_simple,
        _ST_DistanceUncached(ST_GeometryN(t1.geom,1),
 ST_GeometryN(t2.geom,1)) AS dist_geography_uncached_simple
 FROM tt t1, tt t2
 WHERE t1.gid=1 AND t2.gid=3;
 }}}


 On POSTGIS="2.4.3 r16312" PGSQL="100" GEOS="3.6.2-CAPI-1.10.2 4d2925d"
 PROJ="Rel. 4.9.3, 15 August 2016" GDAL="GDAL 2.2.4, released 2018/03/19"
 LIBXML="2.7.8" LIBJSON="0.12" LIBPROTOBUF="1.2.1" RASTER I get


 {{{
  gid1 | gid2 |    dist_lonlat    |     dist_utm     | dist_geography |
 dist_geography_tree | dist_geography_uncached | dist_geography_tree_simple
 | dist_geography_uncached_simple
 ------+------+-------------------+------------------+----------------+---------------------+-------------------------+----------------------------+--------------------------------
     1 |    3 | 0.185028680023504 | 18357.3813638682 | 18358.86600725 |
 0 |        18358.8660072466 |           18358.8660072466 |
 18358.8660072466
 (1 row)

 }}}


 But on 2.5.1 and 2.4.4
 {{{
 postgis_full_version
 -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  POSTGIS="2.5.1 r17027" [EXTENSION] PGSQL="110" GEOS="3.7.0-CAPI-1.11.0
 3.7.1" PROJ="Rel. 4.9.3, 15 August 2016" GDAL="GDAL 2.2.4, released
 2018/03/19" LIBXML="2.7.8" LIBJSON="0.12" LIBPROTOBUF="1.2.1" (
 (1 row)}}}

 I get:

 {{{
  gid1 | gid2 |    dist_lonlat    |     dist_utm     | dist_geography |
 dist_geography_tree | dist_geography_uncached | dist_geography_tree_simple
 | dist_geography_uncached_simple
 ------+------+-------------------+------------------+----------------+---------------------+-------------------------+----------------------------+--------------------------------
     1 |    3 | 0.185028680023504 | 18357.3813638682 |              0 |
 0 |        18358.8660072466 |           18358.8660072466 |
 18358.8660072466
 (1 row)
 }}}

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