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

Daniel Baston dbaston at gmail.com
Tue Sep 6 15:57:02 PDT 2016


Author: dbaston
Date: 2016-09-06 15:57:02 -0700 (Tue, 06 Sep 2016)
New Revision: 15075

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

Modified: branches/2.2/postgis/lwgeom_export.c
===================================================================
--- branches/2.2/postgis/lwgeom_export.c	2016-09-06 22:44:47 UTC (rev 15074)
+++ branches/2.2/postgis/lwgeom_export.c	2016-09-06 22:57:02 UTC (rev 15075)
@@ -622,9 +622,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: branches/2.2/postgis/lwgeom_in_encoded_polyline.c
===================================================================
--- branches/2.2/postgis/lwgeom_in_encoded_polyline.c	2016-09-06 22:44:47 UTC (rev 15074)
+++ branches/2.2/postgis/lwgeom_in_encoded_polyline.c	2016-09-06 22:57:02 UTC (rev 15075)
@@ -35,9 +35,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: branches/2.2/regress/in_encodedpolyline.sql
===================================================================
--- branches/2.2/regress/in_encodedpolyline.sql	2016-09-06 22:44:47 UTC (rev 15074)
+++ branches/2.2/regress/in_encodedpolyline.sql	2016-09-06 22:57:02 UTC (rev 15075)
@@ -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: branches/2.2/regress/in_encodedpolyline_expected
===================================================================
--- branches/2.2/regress/in_encodedpolyline_expected	2016-09-06 22:44:47 UTC (rev 15074)
+++ branches/2.2/regress/in_encodedpolyline_expected	2016-09-06 22:57:02 UTC (rev 15075)
@@ -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: branches/2.2/regress/out_geometry_expected
===================================================================
--- branches/2.2/regress/out_geometry_expected	2016-09-06 22:44:47 UTC (rev 15074)
+++ branches/2.2/regress/out_geometry_expected	2016-09-06 22:57:02 UTC (rev 15075)
@@ -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: branches/2.2/regress/tickets.sql
===================================================================
--- branches/2.2/regress/tickets.sql	2016-09-06 22:44:47 UTC (rev 15074)
+++ branches/2.2/regress/tickets.sql	2016-09-06 22:57:02 UTC (rev 15075)
@@ -974,5 +974,12 @@
     ST_Intersects(ST_Buffer(road.geom, sidewalk_offset + epsilon), sidewalks.geom) -- should be true
 from road, sidewalks, params;
 
+-- #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: branches/2.2/regress/tickets_expected
===================================================================
--- branches/2.2/regress/tickets_expected	2016-09-06 22:44:47 UTC (rev 15074)
+++ branches/2.2/regress/tickets_expected	2016-09-06 22:57:02 UTC (rev 15075)
@@ -293,3 +293,6 @@
 #3470b|50
 ERROR:  Cannot set point values on EMPTY geometry, use ST_AddPoint to add points
 #3579|f|t
+#3583|MULTIPOLYGON Z (EMPTY)
+#3627a|o}~~|AdshNoSsBgd at eGoBlm@wKhj@~@?
+#3627b|t



More information about the postgis-tickets mailing list