[postgis-tickets] [SCM] PostGIS branch main updated. 3.1.0rc1-334-g34382d4

git at osgeo.org git at osgeo.org
Wed Jul 14 05:28:04 PDT 2021


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".

The branch, main has been updated
       via  34382d44f9909c9775dab30499f2f57d856ab12a (commit)
      from  ba702a707c0fdbabf04ec309e2c294250ab82026 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 34382d44f9909c9775dab30499f2f57d856ab12a
Author: Sandro Santilli <strk at kbt.io>
Date:   Wed Jul 14 14:24:01 2021 +0200

    Fix toTopoGeom(TopoGeometry,TopoGeometry) return type
    
    References #4854 in main (3.2.0dev) branch

diff --git a/topology/sql/topogeometry/totopogeom.sql.in b/topology/sql/topogeometry/totopogeom.sql.in
index 2a26349..e5adede 100644
--- a/topology/sql/topogeometry/totopogeom.sql.in
+++ b/topology/sql/topogeometry/totopogeom.sql.in
@@ -204,7 +204,7 @@ BEGIN
         'Layer "%" of topology "%" is %, cannot hold a puntal feature.',
         layer_info.layer_id, topology_info.name, layer_info.typename;
     END IF;
-    tg.type := 1;
+    tg.type := CASE WHEN tg.type = 1 THEN 1 ELSE 4 END;
   ELSIF typ = 'LINESTRING' or typ = 'MULTILINESTRING' THEN -- lineal
     --  A line can go in lineal or collection layer
     IF layer_info.feature_type != 4 and layer_info.feature_type != 2 THEN
@@ -212,7 +212,7 @@ BEGIN
         'Layer "%" of topology "%" is %, cannot hold a lineal feature.',
         layer_info.layer_id, topology_info.name, layer_info.typename;
     END IF;
-    tg.type := 2;
+    tg.type := CASE WHEN tg.type = 2 THEN 2 ELSE 4 END;
   ELSIF typ = 'POLYGON' OR typ = 'MULTIPOLYGON' THEN -- areal
     --  An area can go in areal or collection layer
     IF layer_info.feature_type != 4 and layer_info.feature_type != 3 THEN
@@ -220,7 +220,7 @@ BEGIN
         'Layer "%" of topology "%" is %, cannot hold an areal feature.',
         layer_info.layer_id, topology_info.name, layer_info.typename;
     END IF;
-    tg.type := 3;
+    tg.type := CASE WHEN tg.type = 3 THEN 3 ELSE 4 END;
   ELSE
       -- Should never happen
       RAISE EXCEPTION
diff --git a/topology/test/regress/totopogeom.sql b/topology/test/regress/totopogeom.sql
index f72d58d..32b4a01 100644
--- a/topology/test/regress/totopogeom.sql
+++ b/topology/test/regress/totopogeom.sql
@@ -199,6 +199,132 @@ SELECT 'tgup1.3', id(t.g), st_area(t.g), count(r.*)
   WHERE t.id = -1 AND r.layer_id = 4 AND r.topogeo_id = id(t.g)
   GROUP BY id(t.g), st_area(t.g);
 
+-- Check GeometryType of TopoGeometries getting
+-- other TopoGeometry types added
+-- See https://trac.osgeo.org/postgis/ticket/4854
+BEGIN;
+SELECT '#4854.0.0', GeometryType(
+    toTopoGeom(
+      'POINT(0 0)', -- insert a point
+      toTopoGeom(
+        'POINT(10 0)', -- to a point TopoGeom
+        'tt',
+        5
+      ),
+      5)
+  );
+SELECT '#4854.0.1', GeometryType(
+    toTopoGeom(
+      'POINT(0 0)', -- insert a point
+      toTopoGeom(
+        'LINESTRING(0 0, 10 0)', -- to a linear TopoGeom
+        'tt',
+        5
+      ),
+      5)
+  );
+SELECT '#4854.0.2', GeometryType(
+    toTopoGeom(
+      'POINT(0 0)', -- insert a point
+      toTopoGeom(
+        'POLYGON((0 0,10 0,10 10,0 10,0 0))', -- to a polygonal TopoGeom
+        'tt',
+        5
+      ),
+      5)
+  );
+SELECT '#4854.0.3', GeometryType(
+    toTopoGeom(
+      'POINT(0 0)', -- insert a point
+      toTopoGeom(
+        'GEOMETRYCOLLECTION(POLYGON((0 0,10 0,10 10,0 10,0 0)),POINT(5 5))', -- to a collection TopoGeom
+        'tt',
+        5
+      ),
+      5)
+  );
+SELECT '#4854.1.0', GeometryType(
+    toTopoGeom(
+      'LINESTRING(10 0, 20 0)', -- insert a line
+      toTopoGeom(
+        'POINT(0 0)', -- to a point TopoGeom
+        'tt',
+        5
+      ),
+      5)
+  );
+SELECT '#4854.1.1', GeometryType(
+    toTopoGeom(
+      'LINESTRING(10 0, 20 0)', -- insert a line
+      toTopoGeom(
+        'LINESTRING(0 0, 0 10)', -- to a line TopoGeom
+        'tt',
+        5
+      ),
+      5)
+  );
+SELECT '#4854.1.2', GeometryType(
+    toTopoGeom(
+      'LINESTRING(10 0, 20 0)', -- insert a line
+      toTopoGeom(
+        'POLYGON((0 0, 10 0,10 10,0 10,0 0))', -- to a polygonal TopoGeom
+        'tt',
+        5
+      ),
+      5)
+  );
+SELECT '#4854.1.3', GeometryType(
+    toTopoGeom(
+      'LINESTRING(10 0, 20 0)', -- insert a line
+      toTopoGeom(
+        'GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0, 10 0))', -- to a collection TopoGeom
+        'tt',
+        5
+      ),
+      5)
+  );
+SELECT '#4854.2.0', GeometryType(
+    toTopoGeom(
+      'POLYGON((100 0,100 10,110 10,110 0, 100 0))', -- insert a polygon
+      toTopoGeom(
+        'POINT(100 1)', -- to a puntal TopoGeom
+        'tt',
+        5
+      ),
+      5)
+  );
+SELECT '#4854.2.1', GeometryType(
+    toTopoGeom(
+      'POLYGON((-1 0,0 -2,1 0,-1 0))', -- insert a polygon
+      toTopoGeom(
+        'LINESTRING(200 1, 200 2)', -- to a lineal TopoGeom
+        'tt',
+        5
+      ),
+      5)
+  );
+SELECT '#4854.2.2', GeometryType(
+    toTopoGeom(
+      'POLYGON((-1 0,0 -2,1 0,-1 0))', -- insert a polygon
+      toTopoGeom(
+        'POLYGON((200 1, 200 5,210 2,200 1))', -- to a polygon TopoGeom
+        'tt',
+        5
+      ),
+      5)
+  );
+SELECT '#4854.2.3', GeometryType(
+    toTopoGeom(
+      'POLYGON((-1 0,0 -2,1 0,-1 0))', -- insert a polygon
+      toTopoGeom(
+        'GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 0))', -- to a collection TopoGeom
+        'tt',
+        5
+      ),
+      5)
+  );
+ROLLBACK;
+
 --------------------------------------------------------
 -- http://trac.osgeo.org/postgis/ticket/3359
 --------------------------------------------------------
diff --git a/topology/test/regress/totopogeom_expected b/topology/test/regress/totopogeom_expected
index 6ba1e0a..b11747d 100644
--- a/topology/test/regress/totopogeom_expected
+++ b/topology/test/regress/totopogeom_expected
@@ -44,6 +44,18 @@ custom_search_path|0
 tgup1.1|5|100|1
 tgup1.2|5|200|2
 tgup1.3|5|200|4
+#4854.0.0|MULTIPOINT
+#4854.0.1|GEOMETRYCOLLECTION
+#4854.0.2|GEOMETRYCOLLECTION
+#4854.0.3|GEOMETRYCOLLECTION
+#4854.1.0|GEOMETRYCOLLECTION
+#4854.1.1|MULTILINESTRING
+#4854.1.2|GEOMETRYCOLLECTION
+#4854.1.3|GEOMETRYCOLLECTION
+#4854.2.0|GEOMETRYCOLLECTION
+#4854.2.1|GEOMETRYCOLLECTION
+#4854.2.2|MULTIPOLYGON
+#4854.2.3|GEOMETRYCOLLECTION
 #3359.setval|1|2|1
 #3359.line.1|1
 #3359.line.2|2

-----------------------------------------------------------------------

Summary of changes:
 topology/sql/topogeometry/totopogeom.sql.in |   6 +-
 topology/test/regress/totopogeom.sql        | 126 ++++++++++++++++++++++++++++
 topology/test/regress/totopogeom_expected   |  12 +++
 3 files changed, 141 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list