[postgis-tickets] r15074 - #3627, Encoded polyline functions ignore precision parameter

Daniel Baston dbaston at gmail.com
Tue Sep 6 15:44:47 PDT 2016


Author: dbaston
Date: 2016-09-06 15:44:47 -0700 (Tue, 06 Sep 2016)
New Revision: 15074

Modified:
   trunk/postgis/lwgeom_export.c
   trunk/postgis/lwgeom_in_encoded_polyline.c
   trunk/regress/in_encodedpolyline.sql
   trunk/regress/in_encodedpolyline_expected
   trunk/regress/out_geometry_expected
   trunk/regress/tickets.sql
   trunk/regress/tickets_expected
Log:
#3627, Encoded polyline functions ignore precision parameter

Modified: trunk/postgis/lwgeom_export.c
===================================================================
--- trunk/postgis/lwgeom_export.c	2016-09-06 15:37:28 UTC (rev 15073)
+++ trunk/postgis/lwgeom_export.c	2016-09-06 22:44:47 UTC (rev 15074)
@@ -637,9 +637,9 @@
 	lwgeom = lwgeom_from_gserialized(geom);
 	PG_FREE_IF_COPY(geom, 0);
 	
-	if (PG_NARGS() >2 && !PG_ARGISNULL(2))
+	if (PG_NARGS() > 1 && !PG_ARGISNULL(1))
 	{
-		precision = PG_GETARG_INT32(2);
+		precision = PG_GETARG_INT32(1);
 		if ( precision < 0 ) precision = 5;
 	}
 

Modified: trunk/postgis/lwgeom_in_encoded_polyline.c
===================================================================
--- trunk/postgis/lwgeom_in_encoded_polyline.c	2016-09-06 15:37:28 UTC (rev 15073)
+++ trunk/postgis/lwgeom_in_encoded_polyline.c	2016-09-06 22:44:47 UTC (rev 15074)
@@ -47,9 +47,9 @@
   encodedpolyline_input = PG_GETARG_TEXT_P(0);
   encodedpolyline = text2cstring(encodedpolyline_input);
 
-  if (PG_NARGS() >2 && !PG_ARGISNULL(2))
+  if (PG_NARGS() > 1 && !PG_ARGISNULL(1))
   {
-    precision = PG_GETARG_INT32(2);
+    precision = PG_GETARG_INT32(1);
     if ( precision < 0 ) precision = 5;
   }
 

Modified: trunk/regress/in_encodedpolyline.sql
===================================================================
--- trunk/regress/in_encodedpolyline.sql	2016-09-06 15:37:28 UTC (rev 15073)
+++ trunk/regress/in_encodedpolyline.sql	2016-09-06 22:44:47 UTC (rev 15074)
@@ -1,2 +1,2 @@
 select 'linefromencodedpolyline_01',st_asewkt(st_linefromencodedpolyline('_p~iF~ps|U_ulLnnqC_mqNvxq`@'));
-select 'linefromencodedpolyline_02',st_asewkt(st_linefromencodedpolyline('_p~iFlhz|UuksL`wjCivjNvxq`@', 6));
+select 'linefromencodedpolyline_02',st_asewkt(st_linefromencodedpolyline('_izlhAj}oidF{}jgCrotj at chtxCn`{nI', 6));

Modified: trunk/regress/in_encodedpolyline_expected
===================================================================
--- trunk/regress/in_encodedpolyline_expected	2016-09-06 15:37:28 UTC (rev 15073)
+++ trunk/regress/in_encodedpolyline_expected	2016-09-06 22:44:47 UTC (rev 15074)
@@ -1,2 +1,2 @@
 linefromencodedpolyline_01|SRID=4326;LINESTRING(-120.2 38.5,-120.95 40.7,-126.453 43.252)
-linefromencodedpolyline_02|SRID=4326;LINESTRING(-120.23447 38.5,-120.95 40.73435,-126.453 43.252)
+linefromencodedpolyline_02|SRID=4326;LINESTRING(-120.234472 38.5,-120.95 40.734352,-126.453 43.252)

Modified: trunk/regress/out_geometry_expected
===================================================================
--- trunk/regress/out_geometry_expected	2016-09-06 15:37:28 UTC (rev 15073)
+++ trunk/regress/out_geometry_expected	2016-09-06 22:44:47 UTC (rev 15074)
@@ -41,7 +41,7 @@
 encoded_polyline_01|_p~iF~ps|U_ulLnnqC_mqNvxq`@
 encoded_polyline_02|_p~iF~ps|U_ulLnnqC_mqNvxq`@
 ERROR:  Only SRID 4326 is supported.
-encoded_polyline_04|_p~iFlhz|UuksL`wjCivjNvxq`@
+encoded_polyline_04|_izlhAd}oidF{}jgCxotj at chtxCn`{nI
 svg_empty_geom|
 svg_option_01|M 1 -1 L 4 -4 5 -7
 svg_option_02|M 1 -1 l 3 -3 1 -3

Modified: trunk/regress/tickets.sql
===================================================================
--- trunk/regress/tickets.sql	2016-09-06 15:37:28 UTC (rev 15073)
+++ trunk/regress/tickets.sql	2016-09-06 22:44:47 UTC (rev 15074)
@@ -993,6 +993,9 @@
 -- #3583
 Select '#3583', ST_AsText(ST_GeomFromGeoJSON('{"type":"MultiPolygon", "coordinates":[[[139.10030364990232,35.16777444430609],5842.4224490305424]]}')); 
 
+-- #3627
+SELECT '#3627a', ST_AsEncodedPolyline('SRID=4326;LINESTRING(-0.250691 49.283048,-0.250633 49.283376,-0.250502 49.283972,-0.251245 49.284028,-0.251938 49.284232,-0.251938 49.2842)', 6);
+SELECT '#3627b', ST_Equals(geom, ST_LineFromEncodedPolyline(ST_AsEncodedPolyline(geom, 7), 7)) FROM (VALUES ('SRID=4326;LINESTRING (0 0, 1 1)')) AS v (geom);
 
 -- Clean up
 DELETE FROM spatial_ref_sys;

Modified: trunk/regress/tickets_expected
===================================================================
--- trunk/regress/tickets_expected	2016-09-06 15:37:28 UTC (rev 15073)
+++ trunk/regress/tickets_expected	2016-09-06 22:44:47 UTC (rev 15074)
@@ -296,3 +296,5 @@
 #3470b|50
 #3579|f|t
 #3583|MULTIPOLYGON Z (EMPTY)
+#3627a|o}~~|AdshNoSsBgd at eGoBlm@wKhj@~@?
+#3627b|t



More information about the postgis-tickets mailing list