[postgis-users] Only allowing valid geometries to be created

C F gis_consultant at hotmail.com
Thu Apr 10 15:56:33 PDT 2003


I like #2 (I assume that isValid would also be executed on update).  That 
should put flexibility into the user's hands and not have negative impact on 
performance (except for inserts/updates...which would be minor) or 
functionality.  If the upgrade issue is the worst anyone can come up with, I 
think that's a fairly short-term nuisance for a long-term gain.


>From: chodgson at refractions.net
>Reply-To: PostGIS Users Discussion <postgis-users at postgis.refractions.net>
>To: PostGIS Users Discussion <postgis-users at postgis.refractions.net>
>Subject: Re: [postgis-users] Only allowing valid geometries to be created
>Date: Thu, 10 Apr 2003 15:45:23 -0700
>
>I think #2 is the best solution. The problems with the other posibilities
>(disallowing invalid geometries, slowing down spatial operators) are just
>innacceptable in my mind, while binary incompatibility is something we will
>just have to deal with... we haven't even gotten to release 1.0 yet!
>
>Chris
>
>Quoting David Blasby <dblasby at refractions.net>:
>
> > We are soon going to have functions like intersect(g1,g2), xor(g1,g2),
> > union (g1,g2) - these functions pretty much require valid geometries.
> >
> > The results of a function like union(g1,g2) where g1 or g2 are invalid
> > could cause (1) errors (2) invalid results.
> >
> > I've been thinking about:
> >
> > 1. Only allow valid geometries to be created.  Basically the creation
> > would look like:
> >         a) Create Geometry  like now (does very small amount of validity
> > checking)
> >         b) run the isvalid() function on it.  If it fails, throw an 
>error
> > I.e.:
> > select 'LINESTRING(0 0, 0 0)'::geometry;
> > ERROR: invalid geometry
> >
> > In this way (a) tables will only ever have valid geometries (b)
> > functions will always have valid geometries as inputs (c) Only have to
> > run the isValid() function on a geometry once (at creation).
> >
> > Unfortunately, the main disadvantage to this is sometimes people want to
> > have invalid geometries.  People might have multipolygns that overlap,
> > or GPS tracks that have repeated points, etc...  Unfortunately, they
> > would never be able to get these geometries inside PostGIS - leading to
> > quite a bit of frustration during dataloading or querying.
> >
> > Also, it would require geos to be installed.  As a work around to this,
> > we could just ignore the validity test -  postgis would behave exactly
> > as it does now.  This will not be a problem because all the
> > sensitive-to-invalid-geometry-functions are in GEOS and, therefore,
> > never callable.
> >
> > 2. Add a flag to Geometry that is either VALID, INVALID, UNKNOWN.
> >        a) Create Geometry  like now (does very small amount of validity
> > checking)
> >        b) run the isvalid() function on it.
> >                 INVALID - flag geometry
> >                 VALID     - flag geometry
> >                 geos not installed - flag geometry  UNKNOWN
> >
> > Then the GEOS functions could throw an error if the flag is INVALID.
> >  Bad-dog geometries could still be put into the system, but be unuseable
> > with GEOS .
> > The big problem with this is that these flagged geometries would be
> > binary-incompatible with the current geometries - a dump and restore
> > would be require before you could upgrade.
> >
> > 3. Keep things as they are  - do a isvalid() whenever you do a GEOS
> > function.  This would work fine, but will be slow due to always running
> > isvalid().
> >
> > I'm leaning towards #2.
> >
> > What think?
> > dave
> >
> >
> > _______________________________________________
> > postgis-users mailing list
> > postgis-users at postgis.refractions.net
> > http://postgis.refractions.net/mailman/listinfo/postgis-users
> >
>
>
>
>
>
>_______________________________________________
>postgis-users mailing list
>postgis-users at postgis.refractions.net
>http://postgis.refractions.net/mailman/listinfo/postgis-users


_________________________________________________________________
Tired of spam? Get advanced junk mail protection with MSN 8. 
http://join.msn.com/?page=features/junkmail




More information about the postgis-users mailing list