[postgis-devel] ST_MakePolygon returns null geometry when passedNULL or empty array
Obe, Regina
robe.dnd at cityofboston.gov
Tue Jul 8 10:06:10 PDT 2008
Well I did put a note in my example of using ST_Accum (with a left join that sometimes results in a null passed to the second) and Array() which sometimes results in an empty array.
I suppose I could put the comment at the top too in the first paragraph.
Thanks,
Regina
________________________________
From: postgis-devel-bounces at postgis.refractions.net on behalf of Kevin Neufeld
Sent: Tue 7/8/2008 11:42 AM
To: PostGIS Development Discussion
Subject: Re: [postgis-devel] ST_MakePolygon returns null geometry when passedNULL or empty array
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
_______________________________________________
postgis-devel mailing list
postgis-devel at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20080708/9c316f86/attachment.html>
More information about the postgis-devel
mailing list