[postgis-devel] ST_MakePolygon returns null geometry when passedNULL or empty array

Kevin Neufeld kneufeld at refractions.net
Wed Jul 9 09:11:41 PDT 2008


As a geometry constructor, this method is similar to the WKT or WKB 
parser which don't currently test for validity.  As MarkC pointed out a 
few emails ago (in the "Removing geometry parsing checks" thread), 
isvalid() calls are heavyweight and expensive to make.

Oh the other hand, this method is fundamentally different than the WKT/B 
parser in that it's highly unlikely to be used in any sort of bulk 
loading.  So maybe the performance hit for testing for validity (and 
throwing a NOTICE if necessary) is not so bad?  It would probably be the 
only geometry constructor that tests for validity though.

Cheers,
Kevin

Obe, Regina wrote:
> On the robust side of things should we be concerned that if we feed it
> closed line strings that are not contained in the shell (or is the
> shell) and/or overlap each other.  The function happily returns you an
> invalid geometry.
> 
>  SELECT ST_IsValid(the_geom), ST_AsText(the_geom)
> FROM (
>    SELECT ST_MakePolygon(
>      'LINESTRING(0 0, 0 8, 8 8, 8 0, 0 0)'::geometry,
>      ARRAY['LINESTRING(0 0, 0 8, 8 8, 9 0, 0 0)'::geometry]) AS the_geom
>    ) AS foo;
> 
> seems like it should give you a NOTICE or something.
> 



More information about the postgis-devel mailing list