<br><br><div class="gmail_quote">On 24 August 2010 12:31, Stefan de Konink <span dir="ltr"><<a href="mailto:stefan@konink.de">stefan@konink.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Op 24-08-10 13:17, Mike N. schreef:<br>
<div class="im">><br>
>> ST_IsValid is a relatively expensive operation, so be careful with<br>
>> that. If you are using it a lot, it might be worthfile to just delete<br>
>> invalid geometries once.<br>
><br>
>  I've measured the speed difference at about 8X to use ST_IsValid .<br>
<br>
</div>It is really a bitch that PostgreSQL cannot use the ST_IsValid as index<br>
in queries. Yes, you could manually do the boolean operation yourself,<br>
but still it would be quite handy if the validness wouldn't be checked<br>
at all if it was valid in the first place.<br></blockquote></div><br>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.<br>
One possibility would be to add GEOS to osm2pgsql and check the validity of the polygon in the first place in osm2pgsql.<br><br>Emilie Laffray<br>