From ff391b99443a82bd376e54f2b1b38c9970d9982d Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Fri, 27 Jan 2012 20:14:52 +0000 Subject: [PATCH] Add "face has no rings" validity checking git-svn-id: http://svn.osgeo.org/postgis/trunk@8947 b70326c6-7e19-0410-871a-916f4a2858ee --- topology/test/regress/legacy_invalid_expected | 1 + topology/topology.sql.in.c | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/topology/test/regress/legacy_invalid_expected b/topology/test/regress/legacy_invalid_expected index c9841cfcb..5ae7d2278 100644 --- a/topology/test/regress/legacy_invalid_expected +++ b/topology/test/regress/legacy_invalid_expected @@ -15,6 +15,7 @@ edge crosses edge|30|32 edge start node geometry mis-match|30|4 edge end node geometry mis-match|30|3 face without edges|10| +face has no rings|10| face within face|11|2 face overlaps face|2|12 COMMIT diff --git a/topology/topology.sql.in.c b/topology/topology.sql.in.c index bd6e0ab42..1eda5d473 100644 --- a/topology/topology.sql.in.c +++ b/topology/topology.sql.in.c @@ -1479,10 +1479,23 @@ BEGIN EXECUTE 'CREATE INDEX "face_check_bt" ON ' || 'face_check (face_id);'; + -- Scan the table looking for NULL geometries + FOR rec IN EXECUTE + 'SELECT f1.face_id FROM ' + || 'face_check f1 WHERE f1.geom IS NULL' + LOOP + -- Face missing ! + retrec.error := 'face has no rings'; + retrec.id1 := rec.face_id; + retrec.id2 := NULL; + RETURN NEXT retrec; + END LOOP; + + -- Scan the table looking for overlap or containment -- TODO: also check for MBR consistency FOR rec IN EXECUTE - 'SELECT f1.face_id as id1, f2.face_id as id2, ' + 'SELECT f1.geom, f1.face_id as id1, f2.face_id as id2, ' || ' ST_Relate(f1.geom, f2.geom) as im' || ' FROM ' || 'face_check f1, ' -- 2.50.1