[OSM-dev] invalid geometry in planet_polygon

Emilie Laffray emilie.laffray at gmail.com
Tue Aug 24 12:38:44 BST 2010


On 24 August 2010 12:31, Stefan de Konink <stefan at konink.de> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20100824/89f7085d/attachment.html>


More information about the dev mailing list