From 4655b811d24f7127068da56b57aa451227d24a1c Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Mon, 31 Oct 2011 12:45:46 +0000 Subject: [PATCH] Fix generation of topology in presence of edges with same bounding box (#1261). Includes regress test [RT-SIGTA] git-svn-id: http://svn.osgeo.org/postgis/trunk@8061 b70326c6-7e19-0410-871a-916f4a2858ee --- topology/sql/sqlmm.sql | 2 +- topology/test/regress/st_createtopogeo.sql | 11 +++++++++++ topology/test/regress/st_createtopogeo_expected | 2 ++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/topology/sql/sqlmm.sql b/topology/sql/sqlmm.sql index 1086a23a2..1ff7c40e9 100644 --- a/topology/sql/sqlmm.sql +++ b/topology/sql/sqlmm.sql @@ -3979,7 +3979,7 @@ BEGIN SELECT ST_UnaryUnion(ST_Collect(geom)) FROM ( SELECT geom FROM components WHERE ST_Dimension(geom) = 1 - UNION + UNION ALL SELECT ST_Boundary(geom) FROM components WHERE ST_Dimension(geom) = 2 ) as linework INTO STRICT nodededges; diff --git a/topology/test/regress/st_createtopogeo.sql b/topology/test/regress/st_createtopogeo.sql index 7c97e2b23..77cf18123 100644 --- a/topology/test/regress/st_createtopogeo.sql +++ b/topology/test/regress/st_createtopogeo.sql @@ -201,6 +201,17 @@ select * from print_elements_count('T14'); select * from print_isolated_nodes('T14'); select null from ( select topology.DropTopology('t') ) as dt; +-- See ticket #1261 +select null from ( select topology.CreateTopology('t') > 0 ) as ct; +select 'T15', st_asewkt(g) FROM ( +SELECT g, topology.st_createtopogeo('t', g) FROM ( SELECT +'GEOMETRYCOLLECTION(LINESTRING(-5 -2,0 0), + LINESTRING(0 0,10 10),LINESTRING(0 0,5 2,10 10), + LINESTRING(10 10,12 10)) +'::geometry as g ) as i ) as j; +select * from print_elements_count('T15'); +select * from print_isolated_nodes('T15'); +select null from ( select topology.DropTopology('t') ) as dt; -- clean up DELETE FROM spatial_ref_sys where srid = 4326; diff --git a/topology/test/regress/st_createtopogeo_expected b/topology/test/regress/st_createtopogeo_expected index 92bb61f09..3e2653ddb 100644 --- a/topology/test/regress/st_createtopogeo_expected +++ b/topology/test/regress/st_createtopogeo_expected @@ -34,3 +34,5 @@ T13|1 isolated nodes in face 1 T14|GEOMETRYCOLLECTION(LINESTRING(8 30,16 30,16 38,3 38,3 30,8 30),POINT(4 31),LINESTRING(4 31,7 31,7 34,4 34,4 31),POINT(8 30),POINT(9 6),LINESTRING(9 6,9 14),LINESTRING(9 6,21 6),POLYGON((9 14,21 14,21 6,9 6,9 14)),POINT(9 14),LINESTRING(9 14,9 22),LINESTRING(9 14,21 14),POLYGON((9 22,21 22,21 14,9 14,9 22)),POINT(9 22),LINESTRING(9 22,21 22),POINT(9 35),LINESTRING(9 35,13 35),POINT(13 35),POLYGON((25 30,17 30,17 40,31 40,31 30,25 30)),POINT(20 37),POINT(21 6),LINESTRING(21 6,21 14),LINESTRING(21 6,35 6),POLYGON((21 14,35 14,35 6,21 6,21 14)),POINT(21 14),LINESTRING(21 14,21 22),LINESTRING(35 14,21 14),POLYGON((21 22,35 22,35 14,21 14,21 22)),POINT(21 22),LINESTRING(21 22,35 22),POINT(25 30),LINESTRING(25 30,25 35),POINT(25 35),POINT(35 6),LINESTRING(35 6,35 14),LINESTRING(35 6,47 6),POLYGON((35 14,47 14,47 6,35 6,35 14)),POINT(35 14),LINESTRING(35 14,35 22),LINESTRING(35 14,47 14),POLYGON((35 22,47 22,47 14,35 14,35 22)),POINT(35 22),LINESTRING(35 22,47 22),LINESTRING(36 38,38 35,41 34,42 33,45 32,47 28,50 28,52 32,57 33),POINT(36 38),LINESTRING(41 40,45 40,47 42,62 41,61 38,59 39,57 36,57 33),POINT(41 40),POINT(47 6),LINESTRING(47 6,47 14),POINT(47 14),LINESTRING(47 14,47 22),POINT(47 22),POINT(57 33)) T14|22 nodes|24 edges|9 faces T14|1 isolated nodes in face 3 +T15|GEOMETRYCOLLECTION(LINESTRING(-5 -2,0 0),LINESTRING(0 0,10 10),LINESTRING(0 0,5 2,10 10),LINESTRING(10 10,12 10)) +T15|4 nodes|4 edges|1 faces -- 2.49.0