[postgis-tickets] [PostGIS] #5268: ST_ShortestLine return invalid linestring when distance of geometries is 0

PostGIS trac at osgeo.org
Wed Oct 26 13:55:51 PDT 2022


#5268: ST_ShortestLine return invalid linestring when distance of geometries is 0
---------------------+---------------------------
 Reporter:  latot    |      Owner:  pramsey
     Type:  defect   |     Status:  new
 Priority:  medium   |  Milestone:  PostGIS 3.3.2
Component:  postgis  |    Version:  3.3.x
 Keywords:           |
---------------------+---------------------------
 Hi all, I was using ST_ShortestLine, it wasn't until I was trying to
 extend I notice there was some linestrings that I wasn't able to extend,
 after checking it I notice this happens when two geometries touches or is
 one over the other, in this cases ST_ShortesLine return an invalid
 linestring:

 ```
 SELECT ST_AsEWKT(ST_3DShortestLine(line,pt)) AS shl3d_line_pt,
                 ST_AsEWKT(ST_ShortestLine(line,pt)) As shl2d_line_pt
         FROM (SELECT 'POINT(0 0 1)'::geometry As pt,
                         'LINESTRING (0 0 0, 0 0 2)'::geometry As line
                 ) As foo;
 LINESTRING(0 0 1,0 0 1) LINESTRING(0 0,0 0)

 SELECT ST_AsText(  ST_ShortestLine(
         'POINT (0 1)',
         'LINESTRING (0 0, 0 2)')
         ) As sline;
 LINESTRING(0 1,0 1)
 ```

 When two elements touches or belongs to each other, I think the behavior
 of ST_ShortestLine should be different, not return that weirds
 linestrings.

 Options, return null (? technically, if the distance is 0, does not exists
 the shortest line.

 Thx!
-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/5268>
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