Skip to content

Commit

Permalink
Merge pull request #7626 from rudivs/kneighbour
Browse files Browse the repository at this point in the history
[feature] Adapted k-neighbour concave hull plugin as QGIS 3 algorithm
  • Loading branch information
luipir committed Sep 14, 2018
2 parents 1192b63 + 8fa27e1 commit 8b07b4e
Show file tree
Hide file tree
Showing 19 changed files with 1,086 additions and 2 deletions.
1 change: 1 addition & 0 deletions images/images.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
<file>themes/default/algorithms/mAlgorithmExtractVertices.svg</file>
<file>themes/default/algorithms/mAlgorithmExtractLayerExtent.svg</file>
<file>themes/default/algorithms/mAlgorithmIntersect.svg</file>
<file>themes/default/algorithms/mAlgorithmConcaveHull.svg</file>
<file>themes/default/algorithms/mAlgorithmLineIntersections.svg</file>
<file>themes/default/algorithms/mAlgorithmLineToPolygon.svg</file>
<file>themes/default/algorithms/mAlgorithmMeanCoordinates.svg</file>
Expand Down
134 changes: 134 additions & 0 deletions images/themes/default/algorithms/mAlgorithmConcaveHull.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions python/plugins/processing/algs/help/qgis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,13 @@ qgis:joinbylocationsummary: >
qgis:keepnbiggestparts: >
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.

qgis:knearestconcavehull: >
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.

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.

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.

qgis:lineintersections: >
This algorithm creates point features where the lines in the Intersect layer intersect the lines in the Input layer.

Expand Down
14 changes: 12 additions & 2 deletions python/plugins/processing/algs/qgis/ConcaveHull.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
from qgis.PyQt.QtCore import QCoreApplication
from math import sqrt

from qgis.core import (QgsFeature,
from qgis.core import (QgsApplication,
QgsFeature,
QgsFeatureSink,
QgsWkbTypes,
QgsProcessing,
Expand Down Expand Up @@ -75,7 +76,16 @@ def name(self):
return 'concavehull'

def displayName(self):
return self.tr('Concave hull')
return self.tr('Concave hull (alpha shapes)')

def shortDescription(self):
return self.tr('Creates a concave hull using the alpha shapes algorithm.')

def icon(self):
return QgsApplication.getThemeIcon("/algorithms/mAlgorithmConcaveHull.svg")

def svgIconPath(self):
return QgsApplication.iconPath("/algorithms/mAlgorithmConcaveHull.svg")

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

0 comments on commit 8b07b4e

Please sign in to comment.