[postgis-devel] Re: [postgis-users] error in isvalid function

strk at refractions.net strk at refractions.net
Fri Nov 5 01:42:24 PST 2004


It seems that the exception is thrown at GeoemtryGraph construction
time. I've coutch the IllegalArgumentException from IsValidOp::checkValid
converting it in an internal TOO_FEW_POINTS TopologyValidationError.

The case here is that the points are there, but are not distinct, and
this information is lost this way. 
Martin, this is probably in JTS too... how sould you fix it ?
Add another TopologyValidateionErrore specific for this case ?

--strk;

On Fri, Nov 05, 2004 at 10:14:58AM +0100, strk at refractions.net wrote:
> On Fri, Nov 05, 2004 at 11:42:46AM +0300, ksa wrote:
> > okay, hole is really invalid. But how I can handle of this situation? If I
> > *already* have polygones with similar holes. Which function I can use to
> > determinate this without getting an exception?
> 
> Problem is that the invalidity of that geometry prevents 
> POSTGIS->GEOS conversion.
> GEOS refuses to build a polygon *that* invalid...
> Maybe the postgis geos wrapped could consider that as an invalidity,
> do people see any drawbacks in this ?
> 
> --strk;
> 
> > 
> > > I've verified your query.
> > > The Polygon is actually invalid due to degenerate hole (as the
> > > exception states).
> > > When extracting the rings, these are handled as LINESTRINGS, for which
> > > the degenerate case is not checked.
> > > Which do you think would be a better handling of this situation ?
> > >
> > > --strk;
> > >
> > >
> > >
> > > On Fri, Nov 05, 2004 at 09:17:01AM +0300, ksa-nil5 wrote:
> > > > >> Hi, all!
> > > > >>
> > > > >> I'm working with follow data (POLYGON):
> > > > >>
> > > > >> POLYGON((37.654639 55.726496,37.654056 55.726947,37.653801
> > 55.727333,37.653801 55.727435,37.654468 55.727483,37.656654
> > 55.727466,37.656572 55.727063,37.656654 55.726713,37.657052
> > 55.726531,37.657571 55.726365,37.658071 55.725961,37.658321
> > 55.725609,37.658303 55.725374,37.658321 55.725609,37.658906
> > 55.725309,37.659488 55.72511,37.658135 55.724571,37.657386
> > 55.724922,37.657135 55.724873,37.65647 55.725274,37.655635
> > 55.725828,37.655195 55.7265,37.655635 55.725927,37.654639
> > 55.726496),(37.658321 55.725609,37.658906 55.725309,37.659488
> > 55.72511,37.658906 55.725309,37.658321 55.725609))
> > > > >>
> > > > >> search=# select isvalid(geometryFromText(the_geom));
> > > > >> NOTICE:  IllegalArgumentException: degenerate ring (does not contain
> > 3 distinct points)
> > > > >> ERROR:  GEOS isvalid() threw an error!
> > > > >>
> > > > >> search=# select isvalid(exteriorring(geometryFromText(the_geom)));
> > > > >>  isvalid
> > > > >> ---------
> > > > >>  t
> > > > >> (1 row)
> > > > >>
> > > > >> search=# select isvalid(interiorringN(geometryFromText(the_geom),1));
> > > > >>  isvalid
> > > > >> ---------
> > > > >>  t
> > > > >> (1 row)
> > > > >>
> > > > >> Any suggestions?
> > > > >>
> > > > >> Thanks!
> > > > >>
> > > > >> Sergey Karin
> > > > >
> > > > >What GEOS / PostGIS version are you using ?
> > > > >
> > > > >SELECT postgis_full_version();
> > > > >
> > > > >--strk;
> > > > >
> > > >
> > > > search=# select postgis_full_version();
> > > >                                         postgis_full_version
> > >
> > > --------------------------------------------------------------------------
> > ---------------------------
> > > >  POSTGIS="0.9.0" GEOS="2.0.1" PROJ="Rel. 4.4.8, 3 May 2004" USE_STATS
> > DBPROC="0.0.1" RELPROC="0.0.1"
> > > > (1 row)
> _______________________________________________
> 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