[postgis-devel] ST_MakePolygon returns null geometry when passed NULL or empty array
Kevin Neufeld
kneufeld at refractions.net
Tue Jul 8 08:42:06 PDT 2008
I think the current assumption is that if you choose to supply a set of
interior rings that make up the polygon, they should form simple linear
rings. Hence the "input geometries must be closed LINESTRINGs" phrase
in the docs.
You're right, this doesn't work:
postgis=# 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[NULL]) AS the_geom
) AS foo;
ERROR: Hole 0 is not a line
I suppose we could add "make this function more robust" to the TODO list.
In any case, the docs definitely should be clarified.
Cheers,
-- Kevin
Obe, Regina wrote:
> I'm not sure if this expected behavior or not, but it surprised me.
>
> In formulating ST_MakePolygon examples for the docs, I noticed if I
> passed in NULL or an empty array
> for the ST_MakePolygon second arg, I get back a null geometry.
>
> Shouldn't it just return a polygon formed from the first argument?
>
> Thanks,
> Regina
> -----------------------------------------
> The substance of this message, including any attachments, may be
> confidential, legally privileged and/or exempt from disclosure
> pursuant to Massachusetts law. It is intended
> solely for the addressee. If you received this in error, please
> contact the sender and delete the material from any computer.
>
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-devel
More information about the postgis-devel
mailing list