Skip to content

Commit 8b07b4e

Browse files
authored
Merge pull request #7626 from rudivs/kneighbour
[feature] Adapted k-neighbour concave hull plugin as QGIS 3 algorithm
2 parents 1192b63 + 8fa27e1 commit 8b07b4e

19 files changed

+1086
-2
lines changed

images/images.qrc

+1
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
<file>themes/default/algorithms/mAlgorithmExtractVertices.svg</file>
9393
<file>themes/default/algorithms/mAlgorithmExtractLayerExtent.svg</file>
9494
<file>themes/default/algorithms/mAlgorithmIntersect.svg</file>
95+
<file>themes/default/algorithms/mAlgorithmConcaveHull.svg</file>
9596
<file>themes/default/algorithms/mAlgorithmLineIntersections.svg</file>
9697
<file>themes/default/algorithms/mAlgorithmLineToPolygon.svg</file>
9798
<file>themes/default/algorithms/mAlgorithmMeanCoordinates.svg</file>
Loading

python/plugins/processing/algs/help/qgis.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,13 @@ qgis:joinbylocationsummary: >
233233
qgis:keepnbiggestparts: >
234234
This algorithm takes a polygon layer and creates a new polygon layer in which multipart geometries have been removed, leaving only the n largest (in terms of area) parts.
235235

236+
qgis:knearestconcavehull: >
237+
This algorithm generates a concave hull polygon from a set of points. If the input layer is a line or polygon layer, it will use the nodes.
238+
239+
The number of neighbours to consider determines the concaveness of the output polygon. A lower number will result in a concave hull that follows the points very closely, while a higher number will have a smoother shape. The minimum number of neighbour points to consider is 3. A value equal to or greater than the number of points will result in a convex hull.
240+
241+
If a field is selected, the algorithm will group the features in the input layer using unique values in that field and generate individual polygons in the output layer for each group.
242+
236243
qgis:lineintersections: >
237244
This algorithm creates point features where the lines in the Intersect layer intersect the lines in the Input layer.
238245

python/plugins/processing/algs/qgis/ConcaveHull.py

+12-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
from qgis.PyQt.QtCore import QCoreApplication
2929
from math import sqrt
3030

31-
from qgis.core import (QgsFeature,
31+
from qgis.core import (QgsApplication,
32+
QgsFeature,
3233
QgsFeatureSink,
3334
QgsWkbTypes,
3435
QgsProcessing,
@@ -75,7 +76,16 @@ def name(self):
7576
return 'concavehull'
7677

7778
def displayName(self):
78-
return self.tr('Concave hull')
79+
return self.tr('Concave hull (alpha shapes)')
80+
81+
def shortDescription(self):
82+
return self.tr('Creates a concave hull using the alpha shapes algorithm.')
83+
84+
def icon(self):
85+
return QgsApplication.getThemeIcon("/algorithms/mAlgorithmConcaveHull.svg")
86+
87+
def svgIconPath(self):
88+
return QgsApplication.iconPath("/algorithms/mAlgorithmConcaveHull.svg")
7989

8090
def processAlgorithm(self, parameters, context, feedback):
8191
layer = self.parameterAsSource(parameters, ConcaveHull.INPUT, context)

0 commit comments

Comments
 (0)