Skip to content

Commit

Permalink
[processing] Port "Count points in polygon" algorithm to c++
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Nov 26, 2019
1 parent abada63 commit 0b3b712
Show file tree
Hide file tree
Showing 10 changed files with 383 additions and 200 deletions.
Expand Up @@ -998,6 +998,24 @@ can break valid model execution - so use with extreme caution, and consider usin
virtual void initAlgorithm( const QVariantMap &configuration = QVariantMap() );


virtual QString inputParameterName() const;
%Docstring
Returns the name of the parameter corresponding to the input layer.

By default this is the standard "INPUT" parameter name.

.. versionadded:: 3.12
%End

virtual QString inputParameterDescription() const;
%Docstring
Returns the translated description of the parameter corresponding to the input layer.

By default this is a translated "Input layer" string.

.. versionadded:: 3.12
%End

virtual QString outputName() const = 0;
%Docstring
Returns the translated, user visible name for any layers created by this algorithm.
Expand Down
11 changes: 0 additions & 11 deletions python/plugins/processing/algs/help/qgis.yaml
Expand Up @@ -79,17 +79,6 @@ qgis:convertgeometrytype: >

See the "Polygonize" or "Lines to polygons" algorithm for alternative options.

qgis:countpointsinpolygon: >
This algorithm takes a points layer and a polygon layer and counts the number of points from the first one in each polygons of the second one.

A new polygons layer is generated, with the exact same content as the input polygons layer, but containing an additional field with the points count corresponding to each polygon.

An optional weight field can be used to assign weights to each point. If set, the count generated will be the sum of the weight field for each point contained by the polygon.

Alternatively, a unique class field can be specified. If set, points are classified based on the selected attribute, and if several points with the same attribute value are within the polygon, only one of them is counted. The final count of the point in a polygon is, therefore, the count of different classes that are found in it.

Both the weight field and unique class field cannot be specified. If they are, the weight field will take precedence and the unique class field will be ignored.

qgis:creategrid: >
This algorithm creates a vector layer with a grid covering a given extent. Elements in the grid can be points, lines or polygons.The size and/or placement of each element in the grid is defined using a horizontal and vertical spacing. The CRS of the output layer must be defined. The grid extent and the spacing values must be expressed in the coordinates and units of this CRS. The top-left point (minX, maxY) is used as the reference point. That means that, at that point, an element is guaranteed to be placed. Unless the width and height of the selected extent is a multiple of the selected spacing, that is not true for the other points that define that extent.

Expand Down
184 changes: 0 additions & 184 deletions python/plugins/processing/algs/qgis/PointsInPolygon.py

This file was deleted.

2 changes: 0 additions & 2 deletions python/plugins/processing/algs/qgis/QgisAlgorithmProvider.py
Expand Up @@ -69,7 +69,6 @@
from .PointsDisplacement import PointsDisplacement
from .PointsFromLines import PointsFromLines
from .PointsFromPolygons import PointsFromPolygons
from .PointsInPolygon import PointsInPolygon
from .PointsToPaths import PointsToPaths
from .PolarPlot import PolarPlot
from .PoleOfInaccessibility import PoleOfInaccessibility
Expand Down Expand Up @@ -167,7 +166,6 @@ def getAlgs(self):
PointsDisplacement(),
PointsFromLines(),
PointsFromPolygons(),
PointsInPolygon(),
PointsToPaths(),
PolarPlot(),
PoleOfInaccessibility(),
Expand Down
1 change: 1 addition & 0 deletions src/analysis/CMakeLists.txt
Expand Up @@ -88,6 +88,7 @@ SET(QGIS_ANALYSIS_SRCS
processing/qgsalgorithmarrayoffsetlines.cpp
processing/qgsalgorithmpolygonstolines.cpp
processing/qgsalgorithmpointonsurface.cpp
processing/qgsalgorithmpointsinpolygon.cpp
processing/qgsalgorithmpointtolayer.cpp
processing/qgsalgorithmpointsalonggeometry.cpp
processing/qgsalgorithmpointslayerfromtable.cpp
Expand Down

0 comments on commit 0b3b712

Please sign in to comment.