<html><body><div style="color:#000; background-color:#fff; font-family:verdana, helvetica, sans-serif;font-size:10pt"><div><span>Danke Birgit,</span></div><div><span><br></span></div><div><span>Good point about the validity of the geometry!  However in my case just by experiment I have deleted all records where st_isvalid(ST_GeomFromEWKT(st_asewkt(the_geom)))='f'</span></div><div><span>From the 11mio records a little over 800 where invalid and deleted. <br></span></div><div><br><span></span></div><div><span>Still my original query crashes on:</span><span> NOTICE:  TopologyException: side location conflict at 129105 515684     ERROR:  GEOS Intersection() threw an error!<br></span></div><div><br><span></span></div><div>All intersection parameters are like ST_SnapToGrid(the_geom, 0.000001) so that doesn't resolve the issue either. Although it makes some difference on which object the process
 crashes.</div><div><br></div><div>Any ideas are still very welcome.</div><div><br></div><div><br></div><div>Thanks,</div><div>Ge<br><span></span></div><div><span><br></span></div><div><br></div><div style="font-family: verdana, helvetica, sans-serif; font-size: 10pt;"><div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"><font face="Arial" size="2"><hr size="1"><b><span style="font-weight:bold;">From:</span></b> Birgit Laggner <birgit.laggner@vti.bund.de><br><b><span style="font-weight: bold;">To:</span></b> postgis-users@postgis.refractions.net<br><b><span style="font-weight: bold;">Sent:</span></b> Tuesday, October 4, 2011 10:35 AM<br><b><span style="font-weight: bold;">Subject:</span></b> Re: [postgis-users] ST_Insersection problem<br></font><br>
<div id="yiv687799058">
  

    
  
  
    Hallo Ge,<br>
    <br>
    this intersection error happens very often to me, too. Mostly, this
    is really due to invalid polygons. My experience is, that the
    validity of some polygons seems to depend on precision issues. If I
    am testing these geometries with st_isvalid, everything seems to be
    fine, but if I do a conversion into wkt format and back on the same
    geometries, the result is not valid anymore. So, my first step in
    your case would be to test validity of the converted geometries and
    repair the invalid ones.<br>
    <br>
    If the problem of the intersection error still occurs, my next
    proposal would be to execute the intersection within a function with
    a loop and an exception handler. And in the exception handler I
    would experiment with small buffers and small polygon corrections
    with st_snaptogrid().<br>
    <br>
    If you need more details or an example, just ask...<br>
    <br>
    Birgit.<br>
    <br>
    <br>
    Am 04.10.2011 09:58, schrieb G. van Es:
    <blockquote type="cite">
      <div style="color:#000;background-color:#fff;font-family:verdana, helvetica, sans-serif;font-size:10pt;">
        <div><span>Hi Andrea,</span></div>
        <div><br>
          <span></span></div>
        <div><span>I'm still working on this issue. To my knowledge
            there are no Collections. The GeometryType on all records in
            both tables is POLYGON. So I expect the LINESTRING error to
            be an internal issue where I'm unable to detect or prevent
            this from happening.</span></div>
        <div><span><br>
          </span></div>
        <div><span>I you or anybody else has some idea's please let me
            know.</span></div>
        <div><br>
          <span></span></div>
        <div><span>thanks,</span></div>
        <div><span>Ge</span></div>
        <div><br>
        </div>
        <div style="font-family:verdana, helvetica, sans-serif;font-size:10pt;">
          <div style="font-family:times new roman, new york, times, serif;font-size:12pt;"><font face="Arial" size="2">
              <hr size="1"><b><span style="font-weight:bold;">From:</span></b>
              Andrea Peri <a rel="nofollow" class="yiv687799058moz-txt-link-rfc2396E" ymailto="mailto:aperi2007@gmail.com" target="_blank" href="mailto:aperi2007@gmail.com"><aperi2007@gmail.com></a><br>
              <b><span style="font-weight:bold;">To:</span></b> PostGIS
              Users Discussion
              <a rel="nofollow" class="yiv687799058moz-txt-link-rfc2396E" ymailto="mailto:postgis-users@postgis.refractions.net" target="_blank" href="mailto:postgis-users@postgis.refractions.net"><postgis-users@postgis.refractions.net></a><br>
              <b><span style="font-weight:bold;">Sent:</span></b>
              Thursday, September 22, 2011 12:02 PM<br>
              <b><span style="font-weight:bold;">Subject:</span></b>
              Re: [postgis-users] ST_Insersection problem<br>
            </font><br>
            <div id="yiv687799058">
              <pre>>Hello Group,
>We are using "POSTGIS="1.5.1" GEOS="3.2.2-CAPI-1.6.2" PROJ="Rel. 4.7.1, 23 September 2009" LIBXML="2.7.6" USE_STATS" and having a problem with ST_Intersection().

>Given the following query
>select count(st_intersection(tbl_a.the_geom,tbl_b.the_geom)) from tbl_a, tbl_b;
>will result in this error message
>NOTICE:  TopologyException: found non-noded intersection between LINESTRING (62723.7 426635, 62722.5 426634) and LINESTRING (62723.7 426635, 62726.2 426632) at 62723.7 426635

>ERROR: GEOS Intersection() threw an error!
>SQL status:XX000
>
>After the NOTICE message we expect the query to continue but it doesn't.  Both tables have all records st_isvalid='t'.
>

>Does anyone know a solution or workaround for this problem?
>
>Thanks,

Hi,
I give my 2ct. :)
The problemyou report is not really a problem of postgis, but instead is a problem of the finite arithmetic use by the pcs and of the methematical algorithm used .


I have every time the error you report.
Please notice I run about 10-20 million records of geometry and some geometry has also 1 million vertex :)

Is a nightmare.
But this is the beautiful and the hell of the arithmetic finite .


To resolve this you must detect at every step what happened and filter they using specific "where" clause or CASE operators.

Is pretty easy,
you will see often it return a Collection, and you get only the lines or the polys from that, again

you can filter out the empty geometry.
After this long path you will have a good procedure to clean all the problem of a real intersection on a arithmetic finite machine.

Regards,
Andrea Peri.

</pre>
              <br clear="all">
              <br>
              -- <br>
              -----------------<br>
              Andrea Peri<br>
              . . . . . . . . . <br>
              qwerty אטלעש<br>
              -----------------<br>
              <br>
            </div>
            <br>
            _______________________________________________<br>
            postgis-users mailing list<br>
            <a rel="nofollow" ymailto="mailto:postgis-users@postgis.refractions.net" target="_blank" href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>
            http://postgis.refractions.net/mailman/listinfo/postgis-users<br>
            <br>
            <br>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="yiv687799058mimeAttachmentHeader"></fieldset>
      <br>
      <pre>_______________________________________________
postgis-users mailing list
<a rel="nofollow" class="yiv687799058moz-txt-link-abbreviated" ymailto="mailto:postgis-users@postgis.refractions.net" target="_blank" href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a>
<a rel="nofollow" class="yiv687799058moz-txt-link-freetext" target="_blank" href="http://postgis.refractions.net/mailman/listinfo/postgis-users">http://postgis.refractions.net/mailman/listinfo/postgis-users</a>
</pre>
    </blockquote>
  

</div><br>_______________________________________________<br>postgis-users mailing list<br><a ymailto="mailto:postgis-users@postgis.refractions.net" href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br><a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br><br><br></div></div></div></body></html>