On 24 August 2010 12:31, Stefan de Konink <[email protected]> wrote: > Op 24-08-10 13:17, Mike N. schreef: > > > >> ST_IsValid is a relatively expensive operation, so be careful with > >> that. If you are using it a lot, it might be worthfile to just delete > >> invalid geometries once. > > > > I've measured the speed difference at about 8X to use ST_IsValid . > > It is really a bitch that PostgreSQL cannot use the ST_IsValid as index > in queries. Yes, you could manually do the boolean operation yourself, > but still it would be quite handy if the validness wouldn't be checked > at all if it was valid in the first place. >
I agree. When I worked on the Corine import, I was bitten by this. I ended up checking all geometries before doing any work on them. For those who were invalid (for checking overlaps), I used ST_ConvexHull to build a valid polygon out of it. It is unfortunately probably not a valid way of dealing with the initial problem here. One possibility would be to add GEOS to osm2pgsql and check the validity of the polygon in the first place in osm2pgsql. Emilie Laffray
_______________________________________________ dev mailing list [email protected] http://lists.openstreetmap.org/listinfo/dev

