]> granicus.if.org Git - postgis/commitdiff
correct length for closed circles (#1978)
authorPaul Ramsey <pramsey@cleverelephant.ca>
Fri, 7 Sep 2012 22:20:00 +0000 (22:20 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Fri, 7 Sep 2012 22:20:00 +0000 (22:20 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@10257 b70326c6-7e19-0410-871a-916f4a2858ee

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

diff --git a/NEWS b/NEWS
index 3d4041e9641e88fa22fd75c5bafcf12b9407a653..35bb146dc1e1a815174d3b173b39ef2c84b6d395 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -34,6 +34,7 @@ PostGIS 2.1.0
   - #1802, improved function interruptibility.
   - #1856, tiger geocoder: reverse geocoder rating setting for prefer numbered highway name
   - #1938, Refactor basic ST_AddBand to add multiple new bands in one call
+  - #1978, wrong answer when calculating length of a closed circular arc (circle)
 
 * Fixes *
 
index f8a70cbf843adcaaf1a38eddc12f62242a8758fa..52605f54c79b21f4d302accdeeba66c624b55fbc 100644 (file)
@@ -178,7 +178,7 @@ lwcircle_segmentize(POINT4D *p1, POINT4D *p2, POINT4D *p3, uint32_t perQuad)
                is_circle = LW_TRUE;
        
        /* Negative radius signals straight line, p1/p2/p3 are colinear */
-       if ( radius < 0.0 || p2_side == 0 )
+       if ( (radius < 0.0 || p2_side == 0) && ! is_circle )
            return NULL;
                
        /* The side of the p1/p3 line that p2 falls on dictates the sweep  
index ec791def640ec82e721f8655e35ea6fe7ae27138..d336267cc3063bf4ef6617b3018468dcc8b3780b 100644 (file)
@@ -717,5 +717,8 @@ select st_astext(st_geomfromgml(
 -- #1957 --
 SELECT '#1957', ST_Distance(ST_Makeline(ARRAY['POINT(1 0)'::geometry]), 'POINT(0 0)'::geometry);
 
+-- #1978 --
+SELECT '#1978', round(ST_Length(ST_GeomFromText('CIRCULARSTRING(0 0,1 0,0 0)',0))::numeric,4);
+
 -- Clean up
 DELETE FROM spatial_ref_sys;
index fe3f74af6c84384d0e4d3d5c32f5a8cb2f325bed..29759788c82c27637a8b1847f37e6a3657c5d4eb 100644 (file)
@@ -222,3 +222,4 @@ NOTICE:  SRID value -1 converted to the officially unknown SRID value 0
 ERROR:  ST_Segmentize: invalid max_distance 0 (must be >= 0)
 ERROR:  invalid GML representation
 #1957|1
+#1978|3.1413