[PostGIS] #5604: ST_Distance doesn't return the minimum distance of two geometries.

PostGIS trac at osgeo.org
Mon Nov 6 00:41:04 PST 2023


#5604: ST_Distance doesn't return the minimum distance of two geometries.
---------------------+---------------------------
 Reporter:  Wenjing  |      Owner:  pramsey
     Type:  defect   |     Status:  new
 Priority:  medium   |  Milestone:  PostGIS 3.4.1
Component:  postgis  |    Version:  3.4.x
 Keywords:           |
---------------------+---------------------------
 Consider this statement:


 {{{
 SELECT ST_Distance(a2, a1), ST_Distance(a1, a2)
 FROM ST_GeomFromText('MULTIPOINT((-2 0), EMPTY)') As a1
 ,ST_GeomFromText(' GEOMETRYCOLLECTION(POINT(1 0),LINESTRING(0 0,1 0))') As
 a2;
 --actual{3,2}
 --expected{2,2}

 }}}

 According to the following definition, ST_Distance returns the minimum
 distance between two geometries :

 returns the minimum 2D Cartesian (planar) distance between two geometries

 Therefore, the result of ST_Distance(a2, a1) should be the same as
 ST_Distance(a1, a2) which is 2.
 However, ST_Distance(a2, a1) returns 3, which seems to be a bug.

 Version:
  POSTGIS="3.5.0dev 3.4.0rc1-748-gaedf3b14f" [EXTENSION] PGSQL="170"
 GEOS="3.13.0dev-CAPI-1.18.0" PROJ="8.2.1 NETWORK_ENABLED=OFF
 URL_ENDPOINT=https://cdn.proj.org USER_WRITABLE_DIRECTORY=/tmp/proj
 DATABASE_PATH=/usr/share/proj/proj.db" LIBXML="2.9.13"
-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/5604>
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