[postgis-tickets] [SCM] PostGIS branch master updated. 3.1.0alpha1-101-g943cda0
git at osgeo.org
git at osgeo.org
Mon May 4 09:02:26 PDT 2020
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, master has been updated
via 943cda089b3dd74b68c805cb935cb00f4a044e43 (commit)
from 39adc44a3f4ecdd4200e5bccf6dec429eeb39cf9 (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 943cda089b3dd74b68c805cb935cb00f4a044e43
Author: Sandro Santilli <strk at kbt.io>
Date: Mon May 4 17:59:50 2020 +0200
ST_GetFaceGeometry: always print corruption information
Use NOTICE when an exception will prevent ValidateTopology
from completing (see #3221).
Also return EMPTY instead of NULL on corruption due to
partial boundaries (consistently with face without
boundaries reported in #3221)
Includes testcase and NEWS item.
Closes #4681
diff --git a/NEWS b/NEWS
index e893b8e..5f62cb1 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,7 @@ Only tickets not included in 3.1.0alpha1
- #4656, Cast a geojson_text::geometry for implicit GeoJSON ingestion (Raúl Marín)
* Enhancements *
+ - #4681, ST_GetFaceGeometry: print corruption information (Sandro Santilli)
- #4651: ST_Simplify: Don't copy if nothing is removed (Raúl Marín)
- #4657: Avoid De-TOASTing where possible (Paul Ramsey)
- #4490, Tweak function costs (Raúl Marín)
diff --git a/liblwgeom/lwgeom_topo.c b/liblwgeom/lwgeom_topo.c
index 6106e81..9df1751 100644
--- a/liblwgeom/lwgeom_topo.c
+++ b/liblwgeom/lwgeom_topo.c
@@ -2784,7 +2784,7 @@ lwt_GetFaceGeometry(LWT_TOPOLOGY* topo, LWT_ELEMID faceid)
LWT_ISO_FACE *face;
LWPOLY *out;
LWGEOM *outg;
- uint64_t i;
+ uint64_t i, edgeid;
int fields;
if (faceid == 0)
@@ -2796,6 +2796,7 @@ lwt_GetFaceGeometry(LWT_TOPOLOGY* topo, LWT_ELEMID faceid)
/* Construct the face geometry */
numfaceedges = 1;
fields = LWT_COL_EDGE_GEOM |
+ LWT_COL_EDGE_EDGE_ID |
LWT_COL_EDGE_FACE_LEFT |
LWT_COL_EDGE_FACE_RIGHT
;
@@ -2827,13 +2828,31 @@ lwt_GetFaceGeometry(LWT_TOPOLOGY* topo, LWT_ELEMID faceid)
}
/* Face has no boundary edges, we'll return EMPTY, see
* https://trac.osgeo.org/postgis/ticket/3221 */
+ lwnotice("Corrupted topology: face %"
+ LWTFMT_ELEMID " has no associated edges.", faceid);
out = lwpoly_construct_empty(topo->srid, topo->hasZ, 0);
return lwpoly_as_lwgeom(out);
}
+ edgeid = edges[0].edge_id;
outg = _lwt_FaceByEdges( topo, edges, numfaceedges );
_lwt_release_edges(edges, numfaceedges);
+ if ( ! outg )
+ {
+ /* Face did have edges but no polygon could be constructed
+ * with that material, sounds like a corrupted topology..
+ *
+ * We'll return EMPTY, see
+ * https://trac.osgeo.org/postgis/ticket/3221 */
+ lwnotice("Corrupted topology: face %"
+ LWTFMT_ELEMID " could not be constructed only from edges "
+ "knowing about it (like edge %" LWTFMT_ELEMID ").",
+ faceid, edgeid);
+ out = lwpoly_construct_empty(topo->srid, topo->hasZ, 0);
+ return lwpoly_as_lwgeom(out);
+ }
+
return outg;
}
diff --git a/topology/test/regress/st_getfacegeometry.sql b/topology/test/regress/st_getfacegeometry.sql
index 2bb2c13..14f5a71 100644
--- a/topology/test/regress/st_getfacegeometry.sql
+++ b/topology/test/regress/st_getfacegeometry.sql
@@ -44,4 +44,20 @@ SELECT topology.st_getfacegeometry('', 1);
-- Non-existent face
SELECT topology.st_getfacegeometry('tt', 666);
+-- Face with partial rings
+-- See https://trac.osgeo.org/postgis/ticket/4681
+COPY tt.face(face_id, mbr) FROM STDIN;
+4 POLYGON((0 0,2 2,2 2,0 0))
+\.
+COPY tt.edge_data(
+ edge_id, start_node, end_node,
+ abs_next_left_edge, abs_next_right_edge,
+ next_left_edge, next_right_edge,
+ left_face, right_face, geom) FROM STDIN;
+4 2 1 1 2 1 -2 4 4 LINESTRING(0 0, 2 2)
+\.
+SET client_min_messages TO NOTICE;
+SELECT ST_AsText(topology.st_getfacegeometry('tt', 4));
+SET client_min_messages TO WARNING;
+
SELECT topology.DropTopology('tt');
diff --git a/topology/test/regress/st_getfacegeometry_expected b/topology/test/regress/st_getfacegeometry_expected
index 7516763..db4cd09 100644
--- a/topology/test/regress/st_getfacegeometry_expected
+++ b/topology/test/regress/st_getfacegeometry_expected
@@ -7,4 +7,6 @@ ERROR: SQL/MM Spatial exception - null argument
ERROR: SQL/MM Spatial exception - invalid topology name
ERROR: SQL/MM Spatial exception - invalid topology name
ERROR: SQL/MM Spatial exception - non-existent face.
+NOTICE: Corrupted topology: face 4 could not be constructed only from edges knowing about it (like edge 4).
+POLYGON EMPTY
Topology 'tt' dropped
-----------------------------------------------------------------------
Summary of changes:
NEWS | 1 +
liblwgeom/lwgeom_topo.c | 21 ++++++++++++++++++++-
topology/test/regress/st_getfacegeometry.sql | 16 ++++++++++++++++
topology/test/regress/st_getfacegeometry_expected | 2 ++
4 files changed, 39 insertions(+), 1 deletion(-)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list