]> granicus.if.org Git - postgis/commitdiff
ST_Distance to a one-point LineString returns NULL (#1957)
authorPaul Ramsey <pramsey@cleverelephant.ca>
Fri, 7 Sep 2012 18:27:49 +0000 (18:27 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Fri, 7 Sep 2012 18:27:49 +0000 (18:27 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@10251 b70326c6-7e19-0410-871a-916f4a2858ee

NEWS
liblwgeom/measures.c
regress/tickets.sql
regress/tickets_expected

diff --git a/NEWS b/NEWS
index 94f311a30629fc0efcc6dd5e4db81b9c417a0321..da92ac853bea31091f24b7156e278561924e263c 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -46,6 +46,7 @@ PostGIS 2.1.0
   - #1932, fix raster2pgsql of syntax for index tablespaces
   - #1939, remove custom data types: summarystats, histogram, quantile, valuecount
   - #1951, remove crash on zero-length linestrings
+  - #1957, ST_Distance to a one-point LineString returns NULL 
   - #1981, cleanup of unused variables causing warnings with gcc 4.6+
 
 PostGIS 2.0.1
index b601006fa562f69d192ad5634eb14b66b997d0f6..de7765ee4a294418059623d516688b88f01fe1c9 100644 (file)
@@ -666,6 +666,8 @@ lw_dist2d_pt_ptarray(POINT2D *p, POINTARRAY *pa,DISTPTS *dl)
 
        getPoint2d_p(pa, 0, &start);
 
+       if ( !lw_dist2d_pt_pt(p, &start, dl) ) return LW_FALSE;
+
        for (t=1; t<pa->npoints; t++)
        {
                dl->twisted=twist;
index d4ed858f05916683b4d45804a8b47128d191b654..9008a8e69a376e4560ea259c70f88fcf7c37828e 100644 (file)
@@ -680,5 +680,8 @@ with inp as ( SELECT
 -- #1799 --
 SELECT '#1799', ST_Segmentize('LINESTRING(0 0, 10 0)'::geometry, 0);
 
+-- #1957 --
+SELECT '#1957', ST_Distance(ST_Makeline(ARRAY['POINT(1 0)'::geometry]), 'POINT(0 0)'::geometry);
+
 -- Clean up
 DELETE FROM spatial_ref_sys;
index 1a5d5be7ffb191ba01f583931ca83e685041a555..d8cd736c96917e0d5fdcbc5caa7c67055002d6b9 100644 (file)
@@ -220,3 +220,4 @@ NOTICE:  SRID value -1 converted to the officially unknown SRID value 0
 #1776|POLYGON((0 0,10 0,10 10,0 0))|POLYGON((0 0,10 0,10 10,0 0))
 #1791|4.7
 ERROR:  ST_Segmentize: invalid max_distance 0 (must be >= 0)
+#1957|1