[postgis-tickets] [SCM] PostGIS branch stable-3.1 updated. 3.1.3-7-gd322359
git at osgeo.org
git at osgeo.org
Wed Jul 14 05:30:01 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, stable-3.1 has been updated
via d322359ce2dd5d03780c544659d3b3846ecc02dc (commit)
from d7191135a2db03a6b87543343cca9fb149596f9e (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 d322359ce2dd5d03780c544659d3b3846ecc02dc
Author: Sandro Santilli <strk at kbt.io>
Date: Wed Jul 14 14:24:01 2021 +0200
Fix toTopoGeom(TopoGeometry,TopoGeometry) return type
Closes #4854 in 3.1 branch (3.1.4dev)
diff --git a/NEWS b/NEWS
index dc1d19e..800392d 100644
--- a/NEWS
+++ b/NEWS
@@ -1,7 +1,9 @@
-PostGIS 3.1.4
+PostGIS 3.1.4dev
2021/xx/xx
* Bug Fixes
+ - #4854, Fix type of TopoGeometry receiving different-type
+ TopoGeometry components (Sandro Santilli)
- #4918, Fix rare crash in st_minpossiblevalue (Paul Ramsey)
- #4941, Fix loose mbr in topology.face on update (Sandro Santilli)
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 9d93521..d179242 100644
--- a/topology/test/regress/totopogeom.sql
+++ b/topology/test/regress/totopogeom.sql
@@ -199,6 +199,133 @@ 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
-- NOTE: requires identifier of the second edge to be 2
TRUNCATE tt.relation CASCADE;
diff --git a/topology/test/regress/totopogeom_expected b/topology/test/regress/totopogeom_expected
index bda0c3a..95ae973 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:
NEWS | 4 +-
topology/sql/topogeometry/totopogeom.sql.in | 6 +-
topology/test/regress/totopogeom.sql | 127 ++++++++++++++++++++++++++++
topology/test/regress/totopogeom_expected | 12 +++
4 files changed, 145 insertions(+), 4 deletions(-)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list