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

Paul Ramsey pramsey at cleverelephant.ca
Mon Sep 10 03:27:01 PDT 2018


Author: pramsey
Date: 2018-09-10 15:27:01 -0700 (Mon, 10 Sep 2018)
New Revision: 16726

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


Modified: branches/2.5/liblwgeom/cunit/cu_in_geojson.c
===================================================================
--- branches/2.5/liblwgeom/cunit/cu_in_geojson.c	2018-09-10 22:19:00 UTC (rev 16725)
+++ branches/2.5/liblwgeom/cunit/cu_in_geojson.c	2018-09-10 22:27:01 UTC (rev 16726)
@@ -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: branches/2.5/liblwgeom/lwin_geojson.c
===================================================================
--- branches/2.5/liblwgeom/lwin_geojson.c	2018-09-10 22:19:00 UTC (rev 16725)
+++ branches/2.5/liblwgeom/lwin_geojson.c	2018-09-10 22:27:01 UTC (rev 16726)
@@ -282,7 +282,7 @@
 				}
 				lwfree(ppa);
 				geojson_lwerror("The 'coordinates' in GeoJSON polygon are not sufficiently nested", 4);
-				return NULL;				
+				return NULL;
 			}
 		}
 	}

Modified: branches/2.5/regress/tickets.sql
===================================================================
--- branches/2.5/regress/tickets.sql	2018-09-10 22:19:00 UTC (rev 16725)
+++ branches/2.5/regress/tickets.sql	2018-09-10 22:27:01 UTC (rev 16726)
@@ -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: branches/2.5/regress/tickets_expected
===================================================================
--- branches/2.5/regress/tickets_expected	2018-09-10 22:19:00 UTC (rev 16725)
+++ branches/2.5/regress/tickets_expected	2018-09-10 22:27:01 UTC (rev 16726)
@@ -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