[postgis-devel] [postgis-tickets] r15966 - Fix rare missing boxes in geometry subdivision

Sandro Santilli strk at kbt.io
Wed Oct 11 07:55:28 PDT 2017


On Wed, Oct 11, 2017 at 07:06:07AM -0700, Paul Ramsey wrote:
> Author: pramsey
> Date: 2017-10-11 07:06:07 -0700 (Wed, 11 Oct 2017)
> New Revision: 15966
> 
> Modified:
>    trunk/liblwgeom/lwgeom_geos.c
> Log:
> Fix rare missing boxes in geometry subdivision
> Closes #3886
> 
> 
> Modified: trunk/liblwgeom/lwgeom_geos.c
> ===================================================================
> --- trunk/liblwgeom/lwgeom_geos.c	2017-10-11 14:05:25 UTC (rev 15965)
> +++ trunk/liblwgeom/lwgeom_geos.c	2017-10-11 14:06:07 UTC (rev 15966)
> @@ -262,19 +262,25 @@
>  
>  	if ( autofix )
>  	{
> -		/* check ring for being closed and fix if not */
> -		if ( ! ptarray_is_closed_2d(pa) )
> +		if (pa->npoints < 1)
>  		{
> -			npa = ptarray_addPoint(pa, getPoint_internal(pa, 0), FLAGS_NDIMS(pa->flags), pa->npoints);
> -			pa = npa;
> +			lwerror("ptarray_to_GEOSLinearRing called with autofix and 0 vertices in ring, cannot fix");

Maybe this should just drop the internal link, on autofix, turning
the polygon to an EMPTY if this is the exterior ring...

Worth adding a test for this ?

--strk;



More information about the postgis-devel mailing list