[geos-devel] MakeValid and empty collection component

Sandro Santilli strk at kbt.io
Thu Dec 10 03:08:58 PST 2020


On Thu, Dec 10, 2020 at 01:35:17AM +0100, Even Rouault wrote:
> On mercredi 9 décembre 2020 12:13:17 CET Sandro Santilli wrote:
> > I found out that GEOSMakeValid will remove EMPTY components from
> > collections. The PostGIS implementation of it does not do this.
> > 
> > The rationale was that a collection with EMPTY component is NOT
> > invalid as per OGC specification, so why removing them ? Isn't
> > that a job for CollectionHomogenize or similar ?
> 
> Actually the unit tests have checks for this.
> 
> See tests/xmltester/tests/misc/makevalid.xml
> 
> <case>
>     <desc>makevalid/geometry_collection</desc>
>   <a>GEOMETRYCOLLECTION(POINT EMPTY,LINESTRING EMPTY,POLYGON((0 0,0 1,1 1,1 
> 0,0 0),(0 0.5,0.5 0.1,1 0.5,0 0.5)))</a>
>   <test>
>     <op name="makevalid" arg1="a">
>         GEOMETRYCOLLECTION (MULTIPOLYGON (((0.0 0.0, 0.0 0.5, 0.5 0.1, 1.0 
> 0.5, 1.0 0.0, 0.0 0.0)), ((0.0 0.5, 0.0 1.0, 1.0 1.0, 1.0 0.5, 0.0 
> 0.5))),LINESTRING EMPTY, POINT EMPTY)
>     </op>
>   </test>
> </case>

Odd, for a MULTIPOINT with empty components it seems to strip it.
But I cannot add the test because it looks like EMPTY is not accepted
in WKT:

    MULTIPOINT(EMPTY,1 1,EMPTY,0 0)
    ParseException: Expected number but encountered word: 'EMPTY')

--strk;


More information about the geos-devel mailing list