[postgis-users] Problems with GeomUnion
Bill Binko
bill at binko.net
Fri Apr 8 08:54:44 PDT 2005
On Fri, 8 Apr 2005, Mark Cave-Ayland wrote:
> Hi Bill,
>
> > So, obviously, I have some real issues in this data.
>
> This is because you are running a buffer() on a column containing invalid
> geometries - you need to check the validity *before* you pass the geometry
> to a GEOS function. My guess is that you want something like:
>
> SELECT oid from parcels where ndims(parcel_shape, 0) != 2)
I was running buffer() on it to FIX the invalid shapes (per Martin's
suggestion).
I had tried your query before, and it returned zero rows (which makes
sense given the constraint). The buffer() seemed to be converting them to
non-2d.
>
> Which will return the oids for all geometries in the parcel_shape column
> which don't have 2 dimensions.
>
Right: there were none.
> > I thought I might get to the bottom of it with this query:
> >
> > gis=# select oid from (select oid,
> > isvalid(buffer(parcel_shape, 0)) as valid from parcels) as
> > foo where valid = false;
> >
> > But I got:
> >
> > ERROR: invalid memory alloc request size 0
> >
> > That can't be good. :-(
> >
> > Anyway, I'm still plugging at it, so any help is fabulous.
>
> Again, this query fails for the same reason. The following SQL should return
> the oids of all invalid geometries in the parcel_shape column of your
> parcels table:
>
> select foo.oid from (select oid, isvalid(parcel_shape) AS valid from
> parcels) as foo where foo.valid = 'f';
This one gave me a list of 829 invalid shapes (out of 330881). Since
you're suggesting that buffer() can't be run on them, do you have any
suggestions on how to correct them? I got lots of
NOTICE: Self-Intersaction
and
NOTICE: Ring Self-Intersection
messages while the query was running, along with a few uglier lines about
null elements. Should I try to match up the stderr messages with the OIDs
(on stdout) and only run buffer() on the ones with NOTICE:
Self-Intersection?
(Don't get me wrong: I appreciate the help, I'm just flying a bit blind
here.)
Bill
More information about the postgis-users
mailing list