https://issues.qgis.org/https://issues.qgis.org/favicon.ico2015-01-18T03:02:32ZQGIS Issue TrackingQGIS Application - Bug report #11986: Intersection returns the wrong resulthttps://issues.qgis.org/issues/11986?journal_id=586862015-01-18T03:02:32ZGiovanni Manghigiovanni.manghi@gmail.com
<ul><li><strong>Subject</strong> changed from <i>Intersecting with dissolved layer, only last shape of dissolved layer in intersections</i> to <i>Intersection returns the wrong result</i></li><li><strong>Priority</strong> changed from <i>Normal</i> to <i>Severe/Regression</i></li><li><strong>Target version</strong> set to <i>Version 2.8</i></li><li><strong>Affected QGIS version</strong> changed from <i>2.6.0</i> to <i>master</i></li></ul><p>With the same input files the operation worked fine until QGIS 2.2, since 2.4 it returns the wrong result. It affects also the tool in the processig toolbox.</p> QGIS Application - Bug report #11986: Intersection returns the wrong resulthttps://issues.qgis.org/issues/11986?journal_id=592922015-02-11T02:41:47ZMartin Dobiaswonder.sk@gmail.com
<ul></ul><p>Hmm seems to work fine for me. Could you also attach the results you get (B, BD) ?</p>
<p>Which tools is actually the one causing the actual problem - dissolve or intersection or either? (e.g. if you dissolve with 2.2 will the intersection in master return correct result?)</p> QGIS Application - Bug report #11986: Intersection returns the wrong resulthttps://issues.qgis.org/issues/11986?journal_id=592942015-02-11T04:46:44ZGiovanni Manghigiovanni.manghi@gmail.com
<ul></ul><p>Martin Dobias wrote:</p>
<blockquote>
<p>Hmm seems to work fine for me. Could you also attach the results you get (B, BD) ?</p>
<p>Which tools is actually the one causing the actual problem - dissolve or intersection or either? (e.g. if you dissolve with 2.2 will the intersection in master return correct result?)</p>
</blockquote>
<p>Hi Martin, the description is not very clear. Steps:</p>
<ul>
<li>take A and make it multipart using the "ID" column</li>
</ul>
<ul>
<li>intersect the above with B using the (QGIS) instersection tool</li>
</ul>
<ul>
<li>result is wrong (largely incomplete)</li>
</ul>
<p>just tested again on QGIS master.</p> QGIS Application - Bug report #11986: Intersection returns the wrong resulthttps://issues.qgis.org/issues/11986?journal_id=592962015-02-11T05:06:21ZEvangelos Rozos
<ul></ul><p>Martin Dobias wrote:</p>
<blockquote>
<p>Hmm seems to work fine for me. Could you also attach the results you get (B, BD) ?</p>
<p>Which tools is actually the one causing the actual problem - dissolve or intersection or either? (e.g. if you dissolve with 2.2 will the intersection in master return correct result?)</p>
</blockquote>
<p>Hypothesis 1<br />The intersection is the problematic one. But, for this bug to be triggered, a layer prepared with dissolve should be used.</p>
<p>Hypothesis 2<br />Both dissolve and intersection are problematic. Dissolve produces a corrupted layer and intersection fails to detect it and produces unpredictable results.</p> QGIS Application - Bug report #11986: Intersection returns the wrong resulthttps://issues.qgis.org/issues/11986?journal_id=592982015-02-11T05:17:47ZGiovanni Manghigiovanni.manghi@gmail.com
<ul></ul><p>Evangelos Rozos wrote:</p>
<blockquote>
<p>Martin Dobias wrote:</p>
<blockquote>
<p>Hmm seems to work fine for me. Could you also attach the results you get (B, BD) ?</p>
<p>Which tools is actually the one causing the actual problem - dissolve or intersection or either? (e.g. if you dissolve with 2.2 will the intersection in master return correct result?)</p>
</blockquote>
<p>Hypothesis 1<br />The intersection is the problematic one. But, for this bug to be triggered, a layer prepared with dissolve should be used.</p>
<p>Hypothesis 2<br />Both dissolve and intersection are problematic. Dissolve produces a corrupted layer and intersection fails to detect it and produces unpredictable results.</p>
</blockquote>
<p>the issue seems to be when one if inputs is multipart (and again, the qgis tool fail, others available in qgis don't).</p> QGIS Application - Bug report #11986: Intersection returns the wrong resulthttps://issues.qgis.org/issues/11986?journal_id=593182015-02-11T21:54:49ZMartin Dobiaswonder.sk@gmail.com
<ul></ul><p>Hi Giovanni</p>
<p>even if first run singlepart -> multipart (instead of dissolve operation), I still get correct results... Testing on linux 64bit / geos 3.4.2.</p> QGIS Application - Bug report #11986: Intersection returns the wrong resulthttps://issues.qgis.org/issues/11986?journal_id=593252015-02-11T23:49:15ZGiovanni Manghigiovanni.manghi@gmail.com
<ul></ul><p>Martin Dobias wrote:</p>
<blockquote>
<p>Hi Giovanni</p>
<p>even if first run singlepart -> multipart (instead of dissolve operation), I still get correct results... Testing on linux 64bit / geos 3.4.2.</p>
</blockquote>
<p>Hi Martin, <a href="https://www.dropbox.com/s/5jirzrv2bz0hmkj/wrong_intersect.zip?dl=0" class="external">here</a> a project, data and screencast of the issue.</p> QGIS Application - Bug report #11986: Intersection returns the wrong resulthttps://issues.qgis.org/issues/11986?journal_id=593402015-02-12T03:38:28ZMartin Dobiaswonder.sk@gmail.com
<ul></ul><p>Thanks a lot Giovanni - I just took A_multipart + B for intersection from your data - and unfortunately the intersection works correctly on my machine :-(</p>
<p>What is the version of GEOS library on your machine?</p> QGIS Application - Bug report #11986: Intersection returns the wrong resulthttps://issues.qgis.org/issues/11986?journal_id=593462015-02-12T06:13:47ZGiovanni Manghigiovanni.manghi@gmail.com
<ul></ul><p>Martin Dobias wrote:</p>
<blockquote>
<p>Thanks a lot Giovanni - I just took A_multipart + B for intersection from your data - and unfortunately the intersection works correctly on my machine :-(</p>
<p>What is the version of GEOS library on your machine?</p>
</blockquote>
<p>I'm on ubuntu 14.04 and install everything from ubuntugis like most of the ubuntu/mint users. But anyway the same happens on osgeo4w/master.</p>
<p>QGIS version 2.7.0-Master QGIS code revision exported<br />Compiled against Qt 4.8.6 Running against Qt 4.8.6<br />Compiled against GDAL/OGR 1.11.1 Running against GDAL/OGR 1.11.1<br />Compiled against GEOS 3.4.2-CAPI-1.8.2 Running against GEOS 3.4.2-CAPI-1.8.2 r3921<br />PostgreSQL Client Version 9.3.4 SpatiaLite Version 4.1.1<br />QWT Version 5.2.3 PROJ.4 Version 480<br />QScintilla2 Version 2.8.1</p> QGIS Application - Bug report #11986: Intersection returns the wrong resulthttps://issues.qgis.org/issues/11986?journal_id=608712015-05-09T23:02:57ZGiovanni Manghigiovanni.manghi@gmail.com
<ul><li><strong>Target version</strong> changed from <i>Version 2.8</i> to <i>Version 2.8.2</i></li></ul> QGIS Application - Bug report #11986: Intersection returns the wrong resulthttps://issues.qgis.org/issues/11986?journal_id=610842015-05-14T01:02:43ZGiovanni Manghigiovanni.manghi@gmail.com
<ul><li><strong>Target version</strong> changed from <i>Version 2.8.2</i> to <i>Version 2.10</i></li></ul> QGIS Application - Bug report #11986: Intersection returns the wrong resulthttps://issues.qgis.org/issues/11986?journal_id=623122015-06-12T07:02:55ZGiovanni Manghigiovanni.manghi@gmail.com
<ul></ul><p>see also <a class="issue tracker-1 status-5 priority-4 priority- closed" href="https://issues.qgis.org/issues/12949" title="Problem When Doing Intersect (Closed)">#12949</a></p> QGIS Application - Bug report #11986: Intersection returns the wrong resulthttps://issues.qgis.org/issues/11986?journal_id=644082015-10-11T07:30:37ZAnita Graseranitagraser@gmx.at
<ul></ul><p>I followed Giovanni's screencast using OSGeo4W nightly and the results from QGIS/ftools intersect are correct for me.</p>
<p>QGIS version 2.11.0-Master<br />Running against GEOS 3.5.0-CAPI-1.9.0 r4084</p> QGIS Application - Bug report #11986: Intersection returns the wrong resulthttps://issues.qgis.org/issues/11986?journal_id=646252015-10-15T08:31:22ZGiovanni Manghigiovanni.manghi@gmail.com
<ul><li><strong>Target version</strong> changed from <i>Version 2.10</i> to <i>Future Release - High Priority</i></li></ul><p>Anita Graser wrote:</p>
<blockquote>
<p>I followed Giovanni's screencast using OSGeo4W nightly and the results from QGIS/ftools intersect are correct for me.</p>
<p>QGIS version 2.11.0-Master<br />Running against GEOS 3.5.0-CAPI-1.9.0 r4084</p>
</blockquote>
<p>Hi Anita, if you use the provided sample data (so a multipart layer as one of the inputs) then the result is still wrong in master.</p>
<p>cheers!</p> QGIS Application - Bug report #11986: Intersection returns the wrong resulthttps://issues.qgis.org/issues/11986?journal_id=646282015-10-15T10:04:43ZAnita Graseranitagraser@gmx.at
<ul></ul><p>You're right, sorry for the noise, can't make it work now ...</p> QGIS Application - Bug report #11986: Intersection returns the wrong resulthttps://issues.qgis.org/issues/11986?journal_id=677532016-01-29T12:58:13ZGiovanni Manghigiovanni.manghi@gmail.com
<ul></ul><p>Result still wrong in master.<br />Can this be solved before releasing the LTR release?</p> QGIS Application - Bug report #11986: Intersection returns the wrong resulthttps://issues.qgis.org/issues/11986?journal_id=694752016-04-09T08:15:14ZGiovanni Manghigiovanni.manghi@gmail.com
<ul></ul><p>see also <a class="issue tracker-1 status-5 priority-4 priority- closed" href="https://issues.qgis.org/issues/14504" title="The QGIS intersection tool yields incomplete results (Closed)">#14504</a></p> QGIS Application - Bug report #11986: Intersection returns the wrong resulthttps://issues.qgis.org/issues/11986?journal_id=701732016-05-23T02:57:56ZGiovanni Manghigiovanni.manghi@gmail.com
<ul></ul><p>Giovanni Manghi wrote:</p>
<blockquote>
<p>see also <a class="issue tracker-1 status-5 priority-4 priority- closed" href="https://issues.qgis.org/issues/14504" title="The QGIS intersection tool yields incomplete results (Closed)">#14504</a></p>
</blockquote>
<p>in the above ticket seems that there is a regression also in the Processing intersection/clip tools since 2.12.</p> QGIS Application - Bug report #11986: Intersection returns the wrong resulthttps://issues.qgis.org/issues/11986?journal_id=731692016-10-20T05:45:04ZAnonymous
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li></ul><p>Fixed in changeset <a class="changeset" href="https://issues.qgis.org/projects/qgis/repository/revisions/dbbbf610cfcf3fa655118d73d27a197ac1b3b224" title="Check validity of input geometries in intersection algorithm Fail if invalid geometries are foun...">dbbbf610cfcf3fa655118d73d27a197ac1b3b224</a>.</p> QGIS Application - Bug report #11986: Intersection returns the wrong resulthttps://issues.qgis.org/issues/11986?journal_id=731722016-10-20T10:30:25ZEvangelos Rozos
<ul></ul><p>Anonymous wrote:</p>
<blockquote>
<p>Fixed in changeset <a class="changeset" href="https://issues.qgis.org/projects/qgis/repository/revisions/dbbbf610cfcf3fa655118d73d27a197ac1b3b224" title="Check validity of input geometries in intersection algorithm Fail if invalid geometries are foun...">dbbbf610cfcf3fa655118d73d27a197ac1b3b224</a>.</p>
</blockquote>
<p>I can see that sanity checks were added in Intersection. Strictly speaking, this resolves this bug. However, this suggests that the Dissolve function generated a layer with inconsistent geometry. This means another bug exists (see Hypothesis 2 in note 4 of this ticket).</p>
<p>When a release with this commit (dbbbf610cfcf3fa655118d73d27a197ac1b3b224) is ready (any estimations when?) I will try to investigate it.</p> QGIS Application - Bug report #11986: Intersection returns the wrong resulthttps://issues.qgis.org/issues/11986?journal_id=736002016-12-12T04:43:25ZGiovanni Manghigiovanni.manghi@gmail.com
<ul><li><strong>Status</strong> changed from <i>Closed</i> to <i>Reopened</i></li><li><strong>Category</strong> changed from <i>44</i> to <i>Processing/QGIS</i></li></ul><p>This must be reopened: it seems to me that the fix/check is available on 2.18.1 but anyway it fails to return the proper warning. Try do intersection/union with the "sample1" data in</p>
<p><a class="issue tracker-1 status-5 priority-5 priority- closed" href="https://issues.qgis.org/issues/15962" title="Union & Intersection results are Incorrect (Closed)">#15962</a></p>
<p>the problem is that one of the layers has a geometry with an auto-intersection. Upon running the "intersection" operation the wrong result is returned and the only thing that is returned is the following in the QGIS log (which is NOT enough):</p>
<p>2016-12-12T07:36:28 2 GEOS geoprocessing error: One or more input features have invalid geometry.<br />2016-12-12T07:36:28 0 Feature geometry error: One or more output features ignored due to invalid geometry.<br />2016-12-12T07:36:28 2 GEOS geoprocessing error: One or more input features have invalid geometry.<br />2016-12-12T07:36:28 0 Feature geometry error: One or more output features ignored due to invalid geometry.</p>
<p>Please notice that union operation returns wrong results, regardless of the input feature be ok (see images in the above thicket).</p> QGIS Application - Bug report #11986: Intersection returns the wrong resulthttps://issues.qgis.org/issues/11986?journal_id=746732017-02-27T23:01:48ZGiovanni Manghigiovanni.manghi@gmail.com
<ul><li><strong>Affected QGIS version</strong> changed from <i>master</i> to <i>2.18.4</i></li><li><strong>Target version</strong> changed from <i>Future Release - High Priority</i> to <i>Version 2.18</i></li></ul> QGIS Application - Bug report #11986: Intersection returns the wrong resulthttps://issues.qgis.org/issues/11986?journal_id=757332017-04-30T15:08:16ZGiovanni Manghigiovanni.manghi@gmail.com
<ul><li><strong>Regression?</strong> set to <i>Yes</i></li></ul> QGIS Application - Bug report #11986: Intersection returns the wrong resulthttps://issues.qgis.org/issues/11986?journal_id=757832017-04-30T15:08:52ZGiovanni Manghigiovanni.manghi@gmail.com
<ul><li><strong>Priority</strong> changed from <i>Severe/Regression</i> to <i>High</i></li></ul> QGIS Application - Bug report #11986: Intersection returns the wrong resulthttps://issues.qgis.org/issues/11986?journal_id=787592017-04-30T23:10:54ZGiovanni Manghigiovanni.manghi@gmail.com
<ul><li><strong>Easy fix?</strong> set to <i>No</i></li></ul> QGIS Application - Bug report #11986: Intersection returns the wrong resulthttps://issues.qgis.org/issues/11986?journal_id=795922017-05-11T12:43:31ZAlexander Bruy
<ul><li><strong>Status</strong> changed from <i>Reopened</i> to <i>Feedback</i></li><li><strong>Description</strong> updated (<a href="/journals/diff/79592?detail_id=68305" title="View differences">diff</a>)</li></ul><p>Should we close this in favour of <a class="issue tracker-1 status-5 priority-5 priority- closed" href="https://issues.qgis.org/issues/15962" title="Union & Intersection results are Incorrect (Closed)">#15962</a>?</p>
<blockquote>
<p>fix/check is available on 2.18.1 but anyway it fails to return the proper warning</p>
</blockquote>
<p>What is wrong with warnings? Is stopping algorithm in case of errors a better/preffered solution?</p> QGIS Application - Bug report #11986: Intersection returns the wrong resulthttps://issues.qgis.org/issues/11986?journal_id=796632017-05-12T18:05:45ZGiovanni Manghigiovanni.manghi@gmail.com
<ul></ul><blockquote>
<p>What is wrong with warnings? Is stopping algorithm in case of errors a better/preffered solution?</p>
</blockquote>
<p>no warnings other the messages in the LOG, Operation is NOT stopped, the user is left with the impression he/she has the right result.</p> QGIS Application - Bug report #11986: Intersection returns the wrong resulthttps://issues.qgis.org/issues/11986?journal_id=796662017-05-12T18:09:57ZGiovanni Manghigiovanni.manghi@gmail.com
<ul><li><strong>Resolution</strong> set to <i>duplicate</i></li><li><strong>Status</strong> changed from <i>Feedback</i> to <i>Closed</i></li></ul><p>Giovanni Manghi wrote:</p>
<blockquote><blockquote>
<p>What is wrong with warnings? Is stopping algorithm in case of errors a better/preffered solution?</p>
</blockquote>
<p>no warnings other the messages in the LOG, Operation is NOT stopped, the user is left with the impression he/she has the right result.</p>
</blockquote>
<p>merged with <a class="issue tracker-1 status-5 priority-5 priority- closed" href="https://issues.qgis.org/issues/15962" title="Union & Intersection results are Incorrect (Closed)">#15962</a></p> QGIS Application - Bug report #11986: Intersection returns the wrong resulthttps://issues.qgis.org/issues/11986?journal_id=796722017-05-13T05:40:03ZAlexander Bruy
<ul></ul><blockquote>
<p>no warnings other the messages in the LOG, Operation is NOT stopped, the user is left with the impression he/she has the right result.</p>
</blockquote>
<p>Warnings printed to the Processing log, this is how all other Processing tools behave. Additionally we can output them to the dialog's "Log" tab, not sure if this makes sense though.</p>
<p>So, am I right, that stopping algorithm execution when some feature/geometry error occurs will be correct solution? Note that this is different behaviour from fTools.</p> QGIS Application - Bug report #11986: Intersection returns the wrong resulthttps://issues.qgis.org/issues/11986?journal_id=797042017-05-15T15:41:08ZGiovanni Manghigiovanni.manghi@gmail.com
<ul></ul><p>Alexander Bruy wrote:</p>
<blockquote><blockquote>
<p>no warnings other the messages in the LOG, Operation is NOT stopped, the user is left with the impression he/she has the right result.</p>
</blockquote>
<p>Warnings printed to the Processing log, this is how all other Processing tools behave. Additionally we can output them to the dialog's "Log" tab, not sure if this makes sense though.</p>
<p>So, am I right, that stopping algorithm execution when some feature/geometry error occurs will be correct solution? Note that this is different behaviour from fTools.</p>
</blockquote>
<p>Hi Alex, I think that at some point in some (ex ftools) alg is was added a "stop" in case the operation could not be finished.<br />This is whzt we must aim for all the QGIS geoprocessing oprations:</p>
<p>1) stop if the operation can't be finished<br />2) show a clear warning, the LOG is not enough for the vat majority of users</p>
<p>This is the base minimum, QGIS should be able to do better, as other GIS packages do. I'm very in favor to replace this tools with pure SQL based ones, that have proven to be faster and more robust (especially if/when a check to clean geometries is added).</p> QGIS Application - Bug report #11986: Intersection returns the wrong resulthttps://issues.qgis.org/issues/11986?journal_id=797412017-05-16T09:23:44ZGiovanni Manghigiovanni.manghi@gmail.com
<ul></ul><blockquote>
<p>Hi Alex, I think that at some point in some (ex ftools) alg is was added a "stop" in case the operation could not be finished.<br />This is whzt we must aim for all the QGIS geoprocessing oprations:</p>
</blockquote>
<p>the tool that has an option that stops the operation in case of geometry errors is "difference". it has also an option to skip them instead of stopping.<br />I'm not aware of others tools having the same.</p>
<p>Really not ideal, but better that silently returning wrong results.</p>