[postgis-tickets] r16727 - NL warning and add regression test

Paul Ramsey pramsey at cleverelephant.ca
Mon Sep 10 03:28:29 PDT 2018


Author: pramsey
Date: 2018-09-10 15:28:29 -0700 (Mon, 10 Sep 2018)
New Revision: 16727

Modified:
   trunk/liblwgeom/cunit/cu_in_geojson.c
   trunk/liblwgeom/lwin_geojson.c
   trunk/regress/tickets.sql
   trunk/regress/tickets_expected
Log:
NL warning and add regression test 
References #4164



Modified: trunk/liblwgeom/cunit/cu_in_geojson.c
===================================================================
--- trunk/liblwgeom/cunit/cu_in_geojson.c	2018-09-10 22:27:01 UTC (rev 16726)
+++ trunk/liblwgeom/cunit/cu_in_geojson.c	2018-09-10 22:28:29 UTC (rev 16727)
@@ -151,13 +151,6 @@
 
 static void in_geojson_test_geoms(void)
 {
-	
-	/* Incorrect Polygon (#4164) */
-	// do_geojson_test(
-	//     "POLYGON((0 0,0 5,5 5,5 0,0 0))",
-	// 	"{\"type\": \"Polygon\", \"coordinates\": [[0,0],[0,5],[5, 5],[5,0],[0,0]]}",
-	// 	NULL);
-
 	/* Linestring */
 	do_geojson_test(
 	    "LINESTRING(0 1,2 3,4 5)",

Modified: trunk/liblwgeom/lwin_geojson.c
===================================================================
--- trunk/liblwgeom/lwin_geojson.c	2018-09-10 22:27:01 UTC (rev 16726)
+++ trunk/liblwgeom/lwin_geojson.c	2018-09-10 22:28:29 UTC (rev 16727)
@@ -282,7 +282,7 @@
 				}
 				lwfree(ppa);
 				geojson_lwerror("The 'coordinates' in GeoJSON polygon are not sufficiently nested", 4);
-				return NULL;				
+				return NULL;
 			}
 		}
 	}

Modified: trunk/regress/tickets.sql
===================================================================
--- trunk/regress/tickets.sql	2018-09-10 22:27:01 UTC (rev 16726)
+++ trunk/regress/tickets.sql	2018-09-10 22:28:29 UTC (rev 16727)
@@ -1098,6 +1098,8 @@
     select ST_GeogFromText('SRID=4326;POINT(1.0 2.0)') as a, ST_GeogFromText('SRID=4326;POINT(1.0 1.0)') as b
 ) as points;
 
+-- #4164
+SELECT ST_AsText(ST_GeomFromGeoJSON('{"type": "Polygon", "coordinates": [[0,0],[0,5],[5, 5],[5,0],[0,0]]}'));
 
 -- Clean up
 DELETE FROM spatial_ref_sys;

Modified: trunk/regress/tickets_expected
===================================================================
--- trunk/regress/tickets_expected	2018-09-10 22:27:01 UTC (rev 16726)
+++ trunk/regress/tickets_expected	2018-09-10 22:28:29 UTC (rev 16727)
@@ -335,3 +335,4 @@
 #4089|LINESTRING Z (1 1 1,3 3 1)
 ERROR:  lwgeom_pointonsurface: GEOS Error: TopologyException: Input geom 1 is invalid: Self-intersection
 #4081|f|t
+ERROR:  The 'coordinates' in GeoJSON polygon are not sufficiently nested



More information about the postgis-tickets mailing list