Bug report #10999

Unknown exception while reshaping

Added by Reinhard Schimek almost 10 years ago. Updated over 9 years ago.

Status:Closed
Priority:Severe/Regression
Assignee:Luigi Pirelli
Category:Digitising
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:Yes Resolution:
Crashes QGIS or corrupts data:Yes Copied to github as #:19341

Description

To whom it concerns:

Yesterday, when I tried to expand a polygon using the reshape feature in the advance digitized menu, and I received an error stating that an unknown exception has occurred. I went back to the same polygon using version 2.2 without an problems.

qgis_error.jpg (1.03 MB) Reinhard Schimek, 2014-08-02 10:43 AM

Erratzu_Grassland.zip (136 KB) Reinhard Schimek, 2014-08-05 07:44 AM

Associated revisions

Revision 037138fa
Added by Martin Dobias over 9 years ago

Fix #10999 (reshape tool throws GEOS exceptions)

Exceptions fixed earlier by @mkuhn in 37f1a1
Numerical problems found by @arnaud-morvan, corrected by @jef-n

History

#1 Updated by Giovanni Manghi almost 10 years ago

  • Category set to Digitising
  • Status changed from Open to Feedback

In general the reshape tool works fine in qgis 2.4 as it does in 2.2

If you a problematic vector/polygon that makes the tool fail in qgis 2.4 then this is needed to help the developers find the issue. Please attach a sample of the problematic data. Cheers!.

#2 Updated by Reinhard Schimek almost 10 years ago

Hi,

I am confuse that you can no reproduce the error that is shown in attached photo. I created a new polygon layer in QGIS v 2.4 and then used the reshape tool which produced the error. I tried to reinstall QGIS v2.4 several times to see if the issue resolved itself, which it did not. I don't want to second guess you, but have you tried Window version.

If there an updated of v2.4, can you point me in the right direction... attached is the shape file that produce error that is shown in the pic above

thanks, Reinhard

#3 Updated by João Gaspar almost 10 years ago

Hi,

it's a bug that only occurs in scales below to 1:30 in QGIS Chugiak 64-bits

Tested in Windows 7 64-bits OsGeo Installer QGIS Chugiak 2.4 and MASTER (With shapefile and postgis layer)
Tested in Linux Mint 64-its QGIS Chugiak 64-bits

Works fine at all scales in:
Tested in QGIS Valmiera 2.2 32-bits standalone
Tested in QGIS Valmiera 2.2 64-bits standalone

I only need to confirm if this bug occurs in QGIS Chugiak 32-bits, someone can try to zoom in an element in test scales 1:1, 1:15, 1:30 and 1:50, and try to do the reshape element? Please post the results, for developers understand if is a architecture problem or a version bug.

Regards
João

#4 Updated by Giovanni Manghi almost 10 years ago

  • Affected QGIS version changed from 2.4.0 to master
  • OS version deleted (Vista x 64, 7)
  • Status changed from Feedback to Open
  • Priority changed from Normal to Severe/Regression
  • Operating System deleted (Windows )

The problem definitely occour when using the tool at very high scales. In my case it does not happen starting exactly from 1:30 but seems anyway near that point.

#5 Updated by Jürgen Fischer almost 10 years ago

  • OS version set to Vista x64 and 7
  • Subject changed from Error in the Advance Digitized feature to Unknown exception while reshaping
  • Operating System set to Windows
  • Affected QGIS version changed from master to 2.4.0

#6 Updated by Jürgen Fischer almost 10 years ago

  • OS version deleted (Vista x64 and 7)
  • Affected QGIS version changed from 2.4.0 to master
  • Operating System deleted (Windows)

#7 Updated by Giovanni Manghi over 9 years ago

  • Crashes QGIS or corrupts data changed from No to Yes

discarding edits (after getting yhe exception) made my qgis crash.

#8 Updated by Luigi Pirelli over 9 years ago

  • Assignee set to Luigi Pirelli

#9 Updated by Arnaud Morvan over 9 years ago

  • Assignee deleted (Luigi Pirelli)

Should be due to excessive buffer : https://github.com/qgis/QGIS/blob/master/src/core/qgsgeometry.cpp#L5245
I think we should replace -11 by -1 or -2

#10 Updated by Arnaud Morvan over 9 years ago

  • Assignee set to Luigi Pirelli

#11 Updated by Luigi Pirelli over 9 years ago

in my case exception append in this call:

https://github.com/qgis/QGIS/blob/master/src/core/qgsgeometry.cpp#L4871

newRing = GEOSGeom_createLinearRing_r( geosinit.ctxt, newCoordSequence );

investigating the passed values

#12 Updated by Luigi Pirelli over 9 years ago

geos message is:

src/core/qgsgeometry.cpp: 99: (throwGEOSException) GEOS exception: IllegalArgumentException: Points of LinearRing do not form a closed linestring

#13 Updated by Arnaud Morvan over 9 years ago

I've resolve it, I will make a push request:
- double bufferDistance = pow( 1.0L, geomDigits( line2 ) - 11 );
+ double bufferDistance = pow( 0.1L, geomDigits( line2 ) - 2 );

#15 Updated by Luigi Pirelli over 9 years ago

Arnaud Morvan wrote:

Pull request created : https://github.com/qgis/QGIS/pull/1609

checking

#16 Updated by Luigi Pirelli over 9 years ago

Arnaud Morvan wrote:

Pull request created : https://github.com/qgis/QGIS/pull/1609

the pull request doesn't fix the issue (checked with 1:24 scale) still generating the same GEOS exception

#17 Updated by Arnaud Morvan over 9 years ago

We have reduced the problem by reducing the size of the buffer used in QgsGeometry::XXXContainedInLine functions.
The error may still occur depending on:
- the accuracy of the projection used,
- the distance between the object to modify and the nearest point.
So we caught the error, stop capturing and displaying a more specific message.
see the PR : https://github.com/qgis/QGIS/pull/1609

#18 Updated by Giovanni Manghi over 9 years ago

Arnaud Morvan wrote:

We have reduced the problem by reducing the size of the buffer used in QgsGeometry::XXXContainedInLine functions.
The error may still occur depending on:
- the accuracy of the projection used,
- the distance between the object to modify and the nearest point.
So we caught the error, stop capturing and displaying a more specific message.
see the PR : https://github.com/qgis/QGIS/pull/1609

many thanks for the effort! cheers!

#19 Updated by Luigi Pirelli over 9 years ago

  • Pull Request or Patch supplied changed from No to Yes

Tested with Arnaud, and discussed with Giovanni Manghi, I think it is a good compromise to avoid heavy refactoring of the logic of the QgsGeometry::XXXContainedInLine functions.

#20 Updated by Martin Dobias over 9 years ago

  • Status changed from Open to Closed

Also available in: Atom PDF