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

Obe, Regina robe.dnd at cityofboston.gov
Wed Jul 9 09:45:30 PDT 2008


Well on the list of priorities, its pretty low on the totem pole at least for me and I'm not even sure its a desirable thing to do without some configuration switch if there is a cost penalty.  I think a simple note in the docs that these functions will not guarantee validity is sufficient and if they want to throw out invalid results they should do an after processing ST_IsValid check.
 
I think as long as people are aware of it, that's probably good enough.  Just don't want people thinking because PostGIS lets you do it, then it is valid.  
 
Its actually kind of perversely comforting to know that I can create creatures that can't sustain life.  Almost as fun as working in a molecular biology lab again, but less dangerous.
 
Thanks,
Regina

________________________________

From: postgis-devel-bounces at postgis.refractions.net on behalf of Kevin Neufeld
Sent: Wed 7/9/2008 12:11 PM
To: PostGIS Development Discussion
Subject: Re: [postgis-devel] ST_MakePolygon returns null geometrywhen passedNULL or empty array



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.
>
_______________________________________________
postgis-devel mailing list
postgis-devel at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-devel




-----------------------------------------
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20080709/7a5e16f3/attachment.html>


More information about the postgis-devel mailing list