[postgis-devel] isvalid() error

strk at refractions.net strk at refractions.net
Tue Jan 18 04:37:41 PST 2005


Since no one took up on this I've made isvalid() return FALSE
on Geometry construction errors. At least you can do your
geos operation using WHERE isvalid(input) w/out transaction
to be aborted.

--strk;

On Sun, Jan 16, 2005 at 09:58:19AM +0100, strk at refractions.net wrote:
> On Fri, Jan 14, 2005 at 10:44:09PM -0500, Carl Anderson wrote:
> > strk at refractions.net wrote:
> > 
> > >I personally use 3points polygon in visualizzatio apps, as
> > >collapsed polygons still tell us where the original geometry
> > >was, so they actually carry valid information (extent basicaly).
> > >
> > > 
> > >
> > <devils advocate>
> >    is not this a case where a Geometry Collection would be useful.
> >      collection(POLYGON, LINESTRING, POLYGON,...)
> >   you seemed to be argueing for it in the prcision reduction case .......
> > 
> > of course almost no clients support that kind of thing.... ;)
> > 
> > </devils advocate>
> 
> No, this is not the case, as outputting a COLLECTION from a POLYGON
> input is nothing different from outputting a LINESTRING from a
> POLYGON (which I'd say to be more appropriate): it still changes
> geometry type. Also, I see no way a collection() can solve this
> problem as its content would still be the argument of this same
> discussion.
> 
> I'm open to discuss this issue about SnapToGrid() and Simplify(),
> which are the functions I use for output preparation.
> 
> Then, there is another issue: wheter or not to allow 3points polygon
> construction using other functions.
> Note that a self-intersecting ring is also invalid, but checking for
> that as well would be *really* slow (GEOS involved in every path
> of a geometry transformation).
> 
> What I think is that postgis should not check if no 'bare' validity
> things, and that isvalid() should return false instead of throwing
> an exception. 
> 
> --strk;
> 
> > 
> > C.
> > 
> > >So, what we could do is have isvalid() handle number of
> > >polygon ring points itself before attempting to convert to GEOS.
> > >If < 4 return FALSE, else continue to GEOS conversion ...
> > >
> > >--strk;
> > >
> > >On Fri, Jan 14, 2005 at 10:40:44AM -0500, Carl Anderson wrote:
> > > 
> > >
> > >>strk at refractions.net wrote:
> > >>
> > >>   
> > >>
> > >>>PostGIS always allowed polygon rings with 3 points.
> > >>>In this case it disagrees with GEOS about this.
> > >>>Also, PostGIS does not allow 0 points.
> > >>>
> > >>>Should we enforce GEOS constraints or just have isvalid
> > >>>return FALSE in these cases ?
> > >>>
> > >>>
> > >>>
> > >>>     
> > >>>
> > >>a LINESTRING with 3 points is not simple (passes though the same point 
> > >>in space twice) and cannot be a LINEARRING. Hence it cannot be part of a 
> > >>valid POLYOGN
> > >>
> > >>C.
> > >>
> > >>   
> > >>
> > >>>--strk;
> > >>>
> > >>>On Thu, Jan 13, 2005 at 05:07:59PM -0500, Carl Anderson wrote:
> > >>>
> > >>>
> > >>>     
> > >>>
> > >>>>need to test for ring counts prior to sending to GEOS
> > >>>>
> > >>>>select  isvalid(geometry('POLYGON((0 0,0 1,0 0))'));
> > >>>>NOTICE:   IllegalArgumentException: Number of points must be 0 or >3
> > >>>>ERROR:      POSTGIS2GEOS conversion failed
> > >>>>
> > >>>>
> > >>>>-- 
> > >>>>Carl Anderson
> > >>>>GIS Manager Fulton County, Georgia
> > >>>>carl.anderson at co.fulton.ga.us
> > >>>>404.730.8026
> > >>>>
> > >>>>
> > >>>>-----------------------------------------------------
> > >>>>This message has been scanned for viruses and
> > >>>>dangerous content for Fulton County by DefendMail, and is
> > >>>>believed to be clean.
> > >>>>
> > >>>>_______________________________________________
> > >>>>postgis-devel mailing list
> > >>>>postgis-devel at postgis.refractions.net
> > >>>>http://postgis.refractions.net/mailman/listinfo/postgis-devel
> > >>>> 
> > >>>>
> > >>>>       
> > >>>>
> > >>>
> > >>>     
> > >>>
> > >>-- 
> > >>Carl Anderson
> > >>GIS Manager Fulton County, Georgia
> > >>carl.anderson at co.fulton.ga.us
> > >>404.730.8026
> > >>
> > >>
> > >>-----------------------------------------------------
> > >>This message has been scanned for viruses and
> > >>dangerous content for Fulton County by DefendMail, and is
> > >>believed to be clean.
> > >>
> > >>_______________________________________________
> > >>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
> 
> -- 
> 
> For standing up against patentability of software,
> 
>   Thank You, Poland!
> 
> Read the intervention:    http://kwiki.ffii.org/ConsPolon041221En
> Send your thanks:         thankyoupoland.info
> Read/do more:		  http://www.noepatents.org/
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-devel

-- 

For standing up against patentability of software,

  Thank You, Poland!

Read the intervention:    http://kwiki.ffii.org/ConsPolon041221En
Send your thanks:         thankyoupoland.info
Read/do more:		  http://www.noepatents.org/



More information about the postgis-devel mailing list