[PostGIS] #5752: Wrong calculation in geography variant of ST_ClosestPoint()

PostGIS trac at osgeo.org
Thu Jun 27 03:52:24 PDT 2024


#5752: Wrong calculation in geography variant of ST_ClosestPoint()
---------------------+---------------------------
 Reporter:  vogg     |      Owner:  pramsey
     Type:  defect   |     Status:  new
 Priority:  high     |  Milestone:  PostGIS 3.4.3
Component:  postgis  |    Version:  3.4.x
 Keywords:           |
---------------------+---------------------------
 The `geography` variant of `ST_ClosestPoint()` fails to calculate the
 closest point correctly.

 Example query to reproduce this issue:
 {{{
 SELECT ST_AsText(ST_ClosestPoint(
   'LINESTRING (18 9, 18 1)'::geography,
   'POINT (16 4)'::geography
 )) AS cp;
 }}}

 Expected result:
 {{{
  cp
 -------------
  POINT(18 4)
 }}}

 Actual result:
 {{{
  cp
 -------------
  POINT(16 4)
 }}}

 When using `geometry` instead of `geography`, the calculation of
 `ST_ClosestPoint()` works correctly:

 {{{
 SELECT ST_AsText(ST_ClosestPoint(
   'LINESTRING (18 9, 18 1)'::geometry,
   'POINT (16 4)'::geometry
 )) AS cp;
 }}}

 Result:
 {{{
  cp
 -------------
  POINT(18 4)
 }}}

 PostgreSQL version:
 {{{
 PostgreSQL 13.15 (Debian 13.15-1.pgdg110+1) on x86_64-pc-linux-gnu,
 compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
 }}}
 PostGIS version:
 {{{
 POSTGIS="3.4.2 c19ce56" [EXTENSION] PGSQL="130" GEOS="3.9.0-CAPI-1.16.2"
 PROJ="7.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.10" LIBJSON="0.15" LIBPROTOBUF="1.3.3" WAGYU="0.5.0
 (Internal)"
 }}}
-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/5752>
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