Bug report #19615

Concave hull fails for some input data

Added by Rudi von Staden almost 2 years ago.

Status:Open
Priority:Normal
Assignee:-
Category:Processing/QGIS
Affected QGIS version:3.3(master) Regression?:No
Operating System:Windows 10 Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:27442

Description

Concave hull fails for certain input data. It seems that when there are a limited number of points and two of them are on or close to a straight line, the algorithm fails when threshold is not 1. The attached image shows the pink hull as the output for threshold = 1, and the brown hull when threshold is between 0.96 and 0.99. For anything less than 0.96 it fails with the message below. I have attached a project with sample data demonstrating the issue.

Processing algorithm…
Algorithm 'Concave hull' starting…
Input parameters: { 'ALPHA' : 0.3, 'HOLES' : True, 'INPUT' : 'C:/Users/rudi/Dropbox/GIS/shared/concave_hull_test/input.shp', 'NO_MULTIGEOMETRY' : False, 'OUTPUT' : 'memory:' }

Creating Delaunay triangles…
Results: {'OUTPUT': 'output_d516bb08_2edb_46c0_9204_cfa079c0462d'}
Computing edges max length…
Removing features…
Dissolving Delaunay triangles…
Feature could not be written to output_40dd6fbb_5c35_42aa_9c35_436e07335e57
Results: {'OUTPUT': 'output_40dd6fbb_5c35_42aa_9c35_436e07335e57'}
Saving data…
Execution completed in 0.08 seconds
Results: {'OUTPUT': 'output_6fcbb10c_d7fe_48e2_b01e_0f93f29f3b64'}

Loading resulting layers
Algorithm 'Concave hull' finished

QGIS 2.18 also had the same behaviour, although it did include the following exception information:

Uncaught error while executing algorithm
Traceback (most recent call last):
File "C:/OSGeo4W64/apps/qgis-ltr/./python/plugins\processing\core\GeoAlgorithm.py", line 203, in execute
self.processAlgorithm(progress)
File "C:/OSGeo4W64/apps/qgis-ltr/./python/plugins\processing\algs\qgis\Dissolve.py", line 125, in processAlgorithm
outFeat.setAttributes(attrs)
UnboundLocalError: local variable 'attrs' referenced before assignment

concave_hull_bug.PNG - image of sample data (18.5 KB) Rudi von Staden, 2018-08-13 09:56 PM

concave_hull_test.zip - sample project and data (6.1 KB) Rudi von Staden, 2018-08-13 09:58 PM

Also available in: Atom PDF