From 930fb6770db8311613c0a302c9bdd4b9892331ae Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Tue, 12 Jun 2012 09:30:34 +0000 Subject: [PATCH] Really accept collections and multipoints from ST_MakeValid (#1719) Also updates documentation and SQL level tests. git-svn-id: http://svn.osgeo.org/postgis/trunk@9894 b70326c6-7e19-0410-871a-916f4a2858ee --- doc/reference_processing.xml | 8 +++++--- postgis/lwgeom_geos_clean.c | 2 ++ regress/clean.sql | 2 ++ regress/clean_expected | 2 ++ 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/doc/reference_processing.xml b/doc/reference_processing.xml index cfba80b04..0ee8383e0 100644 --- a/doc/reference_processing.xml +++ b/doc/reference_processing.xml @@ -1579,9 +1579,11 @@ SELECT ST_AsEWKT(ST_LineToCurve(ST_GeomFromEWKT('LINESTRING(1 2 3, 3 4 8, 5 6 4, geometry without loosing any of the input vertices. Already-valid geometries are returned w/out further intervention. - + - Supported inputs are: LINESTRINGS, MULTILINESTRINGS, POLYGONS, MULTIPOLYGONS. + Supported inputs are: POINTS, MULTIPOINTS, LINESTRINGS, + MULTILINESTRINGS, POLYGONS, MULTIPOLYGONS and GEOMETRYCOLLECTIONS + containing any mix of them. @@ -1594,7 +1596,7 @@ SELECT ST_AsEWKT(ST_LineToCurve(ST_GeomFromEWKT('LINESTRING(1 2 3, 3 4 8, 5 6 4, Single polygons may become multi-geometries in case of self-intersections. - Availability: 2.0.0, requires GEOS-3.3.0 or higher. + Availability: 2.0.0, requires GEOS-3.3.0 or higher. 2.1.0 added support for GEOMETRYCOLLECTION and MULTIPOINT. &Z_support; diff --git a/postgis/lwgeom_geos_clean.c b/postgis/lwgeom_geos_clean.c index 30220edc3..ce1a6bea4 100644 --- a/postgis/lwgeom_geos_clean.c +++ b/postgis/lwgeom_geos_clean.c @@ -68,10 +68,12 @@ Datum ST_MakeValid(PG_FUNCTION_ARGS) switch ( lwgeom_in->type ) { case POINTTYPE: + case MULTIPOINTTYPE: case LINETYPE: case POLYGONTYPE: case MULTILINETYPE: case MULTIPOLYGONTYPE: + case COLLECTIONTYPE: break; default: diff --git a/regress/clean.sql b/regress/clean.sql index 05d975954..4d4e598e7 100644 --- a/regress/clean.sql +++ b/regress/clean.sql @@ -46,5 +46,7 @@ SELECT origin,caseno, SELECT '#1719.1', ST_AsEWKT(ST_MakeValid('POINT(0 0)')); +SELECT '#1719.2', ST_AsEWKT(ST_MakeValid('GEOMETRYCOLLECTION(POINT(0 0),MULTIPOINT(3 4,5 2),LINESTRING(4 4, 4 4),POLYGON((0 0,10 10,0 10,10 0,0 0)))')); +SELECT '#1719.3', ST_AsEWKT(ST_MakeValid('MULTIPOINT(3 4,5 2)')); DROP TABLE clean_cases; diff --git a/regress/clean_expected b/regress/clean_expected index 13ba3022a..d3159135f 100644 --- a/regress/clean_expected +++ b/regress/clean_expected @@ -27,3 +27,5 @@ PG|3|t|t|f PG|4|t|t|f PG|5|t|t|f #1719.1|POINT(0 0) +#1719.2|GEOMETRYCOLLECTION(POINT(0 0),MULTIPOINT(3 4,5 2),POINT(4 4),MULTIPOLYGON(((0 0,5 5,10 0,0 0)),((5 5,0 10,10 10,5 5)))) +#1719.3|MULTIPOINT(3 4,5 2) -- 2.40.0