[postgis-tickets] [PostGIS] #4953: Small fix to function edge_distance_to_point
PostGIS
trac at osgeo.org
Thu Jul 15 03:13:24 PDT 2021
#4953: Small fix to function edge_distance_to_point
----------------------+---------------------------
Reporter: ezimanyi | Owner: pramsey
Type: defect | Status: new
Priority: medium | Milestone: PostGIS 3.1.3
Component: postgis | Version: 2.5.x
Keywords: geodetic |
----------------------+---------------------------
The third parameter closest can be NULL. This is tested at the end of the
function but not at the beginning. The code below is extracted from
PostGIS 3.1.2.
{{{
double edge_distance_to_point(const GEOGRAPHIC_EDGE *e, const
GEOGRAPHIC_POINT *gp, GEOGRAPHIC_POINT *closest)
{
double d1 = 1000000000.0, d2, d3, d_nearest;
POINT3D n, p, k;
GEOGRAPHIC_POINT gk, g_nearest;
/* Zero length edge, */
if ( geographic_point_equals(&(e->start), &(e->end)) )
{
if (closest) <----------------- Missing test
*closest = e->start;
return sphere_distance(&(e->start), gp);
}
[...]
if (closest)
*closest = g_nearest;
return d_nearest;
}
}}}
Regards
Esteban
--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/4953>
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