From 17c61a3a444737dcd1e33ea1adb4f00a6726b169 Mon Sep 17 00:00:00 2001 From: Paul Ramsey Date: Mon, 10 Sep 2018 22:27:01 +0000 Subject: [PATCH] NL warning and add regression test References #4164 git-svn-id: http://svn.osgeo.org/postgis/branches/2.5@16726 b70326c6-7e19-0410-871a-916f4a2858ee --- liblwgeom/cunit/cu_in_geojson.c | 7 ------- liblwgeom/lwin_geojson.c | 2 +- regress/tickets.sql | 2 ++ regress/tickets_expected | 1 + 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/liblwgeom/cunit/cu_in_geojson.c b/liblwgeom/cunit/cu_in_geojson.c index d2daacd51..bb3ce749d 100644 --- a/liblwgeom/cunit/cu_in_geojson.c +++ b/liblwgeom/cunit/cu_in_geojson.c @@ -151,13 +151,6 @@ static void in_geojson_test_bbox(void) 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)", diff --git a/liblwgeom/lwin_geojson.c b/liblwgeom/lwin_geojson.c index 6f7afcc8d..bea570b07 100644 --- a/liblwgeom/lwin_geojson.c +++ b/liblwgeom/lwin_geojson.c @@ -282,7 +282,7 @@ parse_geojson_polygon(json_object *geojson, int *hasz, int root_srid) } lwfree(ppa); geojson_lwerror("The 'coordinates' in GeoJSON polygon are not sufficiently nested", 4); - return NULL; + return NULL; } } } diff --git a/regress/tickets.sql b/regress/tickets.sql index e4d8bbd3a..8c1784e18 100644 --- a/regress/tickets.sql +++ b/regress/tickets.sql @@ -1098,6 +1098,8 @@ from ( 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; diff --git a/regress/tickets_expected b/regress/tickets_expected index f41f2301e..45f44e602 100644 --- a/regress/tickets_expected +++ b/regress/tickets_expected @@ -335,3 +335,4 @@ ERROR: lwgeom_union: GEOS Error: TopologyException: Input geom 0 is invalid: Se #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 -- 2.49.0