[postgis-tickets] [SCM] PostGIS branch stable-3.1 updated. 3.1.0-9-g051978b
git at osgeo.org
git at osgeo.org
Thu Jan 7 05:52:23 PST 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 051978baee30e9a2f1d2c0f7c87f296506a801ad (commit)
from 22e3168fd3bbce6fbcbc6868b204e6cfa176ba91 (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 051978baee30e9a2f1d2c0f7c87f296506a801ad
Author: Sandro Santilli <strk at kbt.io>
Date: Sun Jan 3 00:24:04 2021 +0100
Avoid listing the same geometry in different collections
Closes #4823 in 3.1 branch (3.1.1dev)
diff --git a/NEWS b/NEWS
index e4440da..f4b771d 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,5 @@
-PostGIS 3.1.1
+PostGIS 3.1.1dev
2021/xx/xx
* Bug Fixes
@@ -8,6 +8,7 @@ PostGIS 3.1.1
(Sandro Santilli)
- #4818, Make the VSICURL synthetic driver work as documented
- #4825, Unstable results from ST_MakeValid (Sandro Santilli)
+ - #4823, Avoid listing the same geometry in different collections
PostGIS 3.1.0
diff --git a/liblwgeom/lwgeom_geos_clean.c b/liblwgeom/lwgeom_geos_clean.c
index 878d91b..3c12e25 100644
--- a/liblwgeom/lwgeom_geos_clean.c
+++ b/liblwgeom/lwgeom_geos_clean.c
@@ -322,7 +322,10 @@ lwcollection_make_geos_friendly(LWCOLLECTION* g)
uint32_t i, new_ngeoms = 0;
LWCOLLECTION* ret;
- if ( ! g->ngeoms ) return lwcollection_as_lwgeom(g);
+ if ( ! g->ngeoms ) {
+ LWDEBUG(3, "lwcollection_make_geos_friendly: returning input untouched");
+ return lwcollection_as_lwgeom(g);
+ }
/* enough space for all components */
new_geoms = lwalloc(sizeof(LWGEOM*) * g->ngeoms);
@@ -334,7 +337,12 @@ lwcollection_make_geos_friendly(LWCOLLECTION* g)
for (i = 0; i < g->ngeoms; i++)
{
LWGEOM* newg = lwgeom_make_geos_friendly(g->geoms[i]);
- if (newg) new_geoms[new_ngeoms++] = newg;
+ if (!newg) continue;
+ if ( newg != g->geoms[i] ) {
+ new_geoms[new_ngeoms++] = newg;
+ } else {
+ new_geoms[new_ngeoms++] = lwgeom_clone(newg);
+ }
}
ret->bbox = NULL; /* recompute later... */
@@ -908,28 +916,20 @@ lwgeom_make_valid(LWGEOM* lwgeom_in)
lwgeom_out = lwgeom_make_geos_friendly(lwgeom_in);
if (!lwgeom_out) lwerror("Could not make a geos friendly geometry out of input");
+ LWDEBUGF(4, "Input geom %p made GEOS-valid as %p", lwgeom_in, lwgeom_out);
+
geosgeom = LWGEOM2GEOS(lwgeom_out, 1);
+ if ( lwgeom_in != lwgeom_out ) {
+ lwgeom_free(lwgeom_out);
+ }
if (!geosgeom)
{
- LWDEBUGF(4,
- "Original geom can't be converted to GEOS (%s)"
- " - will try cleaning that up first",
- lwgeom_geos_errmsg);
-
-
- /* try again as we did cleanup now */
- /* TODO: invoke LWGEOM2GEOS directly with autoclean ? */
- geosgeom = LWGEOM2GEOS(lwgeom_out, 0);
- if (!geosgeom)
- {
- lwerror("Couldn't convert POSTGIS geom to GEOS: %s", lwgeom_geos_errmsg);
- return NULL;
- }
+ lwerror("Couldn't convert POSTGIS geom to GEOS: %s", lwgeom_geos_errmsg);
+ return NULL;
}
else
{
- LWDEBUG(4, "original geom converted to GEOS");
- lwgeom_out = lwgeom_in;
+ LWDEBUG(4, "geom converted to GEOS");
}
#if POSTGIS_GEOS_VERSION < 38
-----------------------------------------------------------------------
Summary of changes:
NEWS | 3 ++-
liblwgeom/lwgeom_geos_clean.c | 36 ++++++++++++++++++------------------
2 files changed, 20 insertions(+), 19 deletions(-)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list