<HTML dir=ltr><HEAD><TITLE>Re: [postgis-devel] ST_MakePolygon returns null geometry when passedNULL or empty array</TITLE>
<META http-equiv=Content-Type content="text/html; charset=unicode">
<META content="MSHTML 6.00.2900.3354" name=GENERATOR></HEAD>
<BODY>
<DIV id=idOWAReplyText17923 dir=ltr>
<DIV dir=ltr><FONT face=Arial color=#000000 size=2>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.</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2></FONT> </DIV>
<DIV dir=ltr><FONT face=Arial size=2>I suppose I could put the comment at the top too in the first paragraph.</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2></FONT> </DIV>
<DIV dir=ltr><FONT face=Arial size=2>Thanks,</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2>Regina</FONT></DIV></DIV>
<DIV dir=ltr><BR>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> postgis-devel-bounces@postgis.refractions.net on behalf of Kevin Neufeld<BR><B>Sent:</B> Tue 7/8/2008 11:42 AM<BR><B>To:</B> PostGIS Development Discussion<BR><B>Subject:</B> Re: [postgis-devel] ST_MakePolygon returns null geometry when passedNULL or empty array<BR></FONT><BR></DIV>
<DIV>
<P><FONT size=2>I think the current assumption is that if you choose to supply a set of<BR>interior rings that make up the polygon, they should form simple linear<BR>rings.  Hence the "input geometries must be closed LINESTRINGs" phrase<BR>in the docs.<BR><BR>You're right, this doesn't work:<BR>postgis=# SELECT ST_IsValid(the_geom), ST_AsText(the_geom)<BR>FROM (<BR>   SELECT ST_MakePolygon(<BR>     'LINESTRING(0 0, 0 8, 8 8, 8 0, 0 0)'::geometry,<BR>     ARRAY[NULL]) AS the_geom<BR>   ) AS foo;<BR>ERROR:  Hole 0 is not a line<BR><BR>I suppose we could add "make this function more robust" to the TODO list.<BR><BR>In any case, the docs definitely should be clarified.<BR><BR>Cheers,<BR>-- Kevin<BR><BR>Obe, Regina wrote:<BR>> I'm not sure if this expected behavior or not, but it surprised me.<BR>><BR>> In formulating ST_MakePolygon examples for the docs, I noticed if I<BR>> passed in NULL or an empty array<BR>> for the ST_MakePolygon second arg, I get back a null geometry.<BR>><BR>> Shouldn't it just return a polygon formed from the first argument?<BR>><BR>> Thanks,<BR>> Regina<BR>> -----------------------------------------<BR>> The substance of this message, including any attachments, may be<BR>> confidential, legally privileged and/or exempt from disclosure<BR>> pursuant to Massachusetts law. It is intended<BR>> solely for the addressee. If you received this in error, please<BR>> contact the sender and delete the material from any computer.<BR>><BR>> _______________________________________________<BR>> postgis-devel mailing list<BR>> postgis-devel@postgis.refractions.net<BR>> <A href="http://postgis.refractions.net/mailman/listinfo/postgis-devel">http://postgis.refractions.net/mailman/listinfo/postgis-devel</A><BR>_______________________________________________<BR>postgis-devel mailing list<BR>postgis-devel@postgis.refractions.net<BR><A href="http://postgis.refractions.net/mailman/listinfo/postgis-devel">http://postgis.refractions.net/mailman/listinfo/postgis-devel</A><BR></FONT></P></DIV></BODY></HTML>