]> granicus.if.org Git - postgis/commitdiff
#3283, be less brittle in cases of box-overlap-but-geom-not
authorPaul Ramsey <pramsey@cleverelephant.ca>
Wed, 23 Sep 2015 18:31:23 +0000 (18:31 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Wed, 23 Sep 2015 18:31:23 +0000 (18:31 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@14089 b70326c6-7e19-0410-871a-916f4a2858ee

liblwgeom/lwlinearreferencing.c

index 6c745fa9cd375744462fc7407d915fe8d46137a7..b702292ba80815489cb497953668fc0b006c666d 100644 (file)
@@ -1302,26 +1302,24 @@ lwgeom_cpa_within(const LWGEOM *g1, const LWGEOM *g2, double maxdist)
 
        if ( nmvals < 2 )
        {
+               /* there's a single time, must be that one... */
+               double t0 = mvals[0];
+               POINT4D p0, p1;
+               LWDEBUGF(1, "Inputs only exist both at a single time (%g)", t0);
+               if ( -1 == ptarray_locate_along_linear(l1->points, t0, &p0, 0) )
                {
-                       /* there's a single time, must be that one... */
-                       double t0 = mvals[0];
-                       POINT4D p0, p1;
-                       LWDEBUGF(1, "Inputs only exist both at a single time (%g)", t0);
-                       if ( -1 == ptarray_locate_along_linear(l1->points, t0, &p0, 0) )
-                       {
-                               lwerror("Could not find point with M=%g on first geom", t0);
-                               return -1;
-                       }
-                       if ( -1 == ptarray_locate_along_linear(l2->points, t0, &p1, 0) )
-                       {
-                               lwerror("Could not find point with M=%g on second geom", t0);
-                               return -1;
-                       }
-                       if ( distance3d_pt_pt((POINT3D*)&p0, (POINT3D*)&p1) <= maxdist )
-                               within = LW_TRUE;
-                       lwfree(mvals);
-                       return within;
+                       lwnotice("Could not find point with M=%g on first geom", t0);
+                       return LW_FALSE;
                }
+               if ( -1 == ptarray_locate_along_linear(l2->points, t0, &p1, 0) )
+               {
+                       lwnotice("Could not find point with M=%g on second geom", t0);
+                       return LW_FALSE;
+               }
+               if ( distance3d_pt_pt((POINT3D*)&p0, (POINT3D*)&p1) <= maxdist )
+                       within = LW_TRUE;
+               lwfree(mvals);
+               return within;
        }
 
        /*