Skip to content

Commit 94856b5

Browse files
ghtmttm-kuhn
authored andcommittedJan 13, 2017
processing qgis count points weighted
1 parent 590abf0 commit 94856b5

File tree

5 files changed

+213
-1
lines changed

5 files changed

+213
-1
lines changed
 
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<GMLFeatureClassList>
2+
<GMLFeatureClass>
3+
<Name>points_wighted</Name>
4+
<ElementPath>points_wighted</ElementPath>
5+
<!--POINT-->
6+
<GeometryType>1</GeometryType>
7+
<SRSName>EPSG:4326</SRSName>
8+
<DatasetSpecificInfo>
9+
<FeatureCount>10</FeatureCount>
10+
<ExtentXMin>-0.42606</ExtentXMin>
11+
<ExtentXMax>9.09096</ExtentXMax>
12+
<ExtentYMin>-2.61064</ExtentYMin>
13+
<ExtentYMax>4.22553</ExtentYMax>
14+
</DatasetSpecificInfo>
15+
<PropertyDefn>
16+
<Name>id</Name>
17+
<ElementPath>id</ElementPath>
18+
<Type>Integer</Type>
19+
</PropertyDefn>
20+
</GMLFeatureClass>
21+
</GMLFeatureClassList>
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<ogr:FeatureCollection
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation=""
5+
xmlns:ogr="http://ogr.maptools.org/"
6+
xmlns:gml="http://www.opengis.net/gml">
7+
<gml:boundedBy>
8+
<gml:Box>
9+
<gml:coord><gml:X>-0.4260638297872343</gml:X><gml:Y>-2.61063829787234</gml:Y></gml:coord>
10+
<gml:coord><gml:X>9.090957446808511</gml:X><gml:Y>4.225531914893617</gml:Y></gml:coord>
11+
</gml:Box>
12+
</gml:boundedBy>
13+
14+
<gml:featureMember>
15+
<ogr:points_wighted fid="points_wighted.0">
16+
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>-0.426063829787234,2.19255319148936</gml:coordinates></gml:Point></ogr:geometryProperty>
17+
<ogr:id>5</ogr:id>
18+
</ogr:points_wighted>
19+
</gml:featureMember>
20+
<gml:featureMember>
21+
<ogr:points_wighted fid="points_wighted.1">
22+
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>1.45053191489362,1.96914893617021</gml:coordinates></gml:Point></ogr:geometryProperty>
23+
<ogr:id>5</ogr:id>
24+
</ogr:points_wighted>
25+
</gml:featureMember>
26+
<gml:featureMember>
27+
<ogr:points_wighted fid="points_wighted.2">
28+
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>1.40585106382979,0.807446808510639</gml:coordinates></gml:Point></ogr:geometryProperty>
29+
<ogr:id>5</ogr:id>
30+
</ogr:points_wighted>
31+
</gml:featureMember>
32+
<gml:featureMember>
33+
<ogr:points_wighted fid="points_wighted.3">
34+
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>0.199468085106383,-0.443617021276596</gml:coordinates></gml:Point></ogr:geometryProperty>
35+
<ogr:id>5</ogr:id>
36+
</ogr:points_wighted>
37+
</gml:featureMember>
38+
<gml:featureMember>
39+
<ogr:points_wighted fid="points_wighted.4">
40+
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>3.63989361702128,0.315957446808511</gml:coordinates></gml:Point></ogr:geometryProperty>
41+
<ogr:id>4</ogr:id>
42+
</ogr:points_wighted>
43+
</gml:featureMember>
44+
<gml:featureMember>
45+
<ogr:points_wighted fid="points_wighted.5">
46+
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>4.28776595744681,-0.823404255319149</gml:coordinates></gml:Point></ogr:geometryProperty>
47+
<ogr:id>1</ogr:id>
48+
</ogr:points_wighted>
49+
</gml:featureMember>
50+
<gml:featureMember>
51+
<ogr:points_wighted fid="points_wighted.6">
52+
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>5.04734042553191,0.070212765957447</gml:coordinates></gml:Point></ogr:geometryProperty>
53+
<ogr:id>4</ogr:id>
54+
</ogr:points_wighted>
55+
</gml:featureMember>
56+
<gml:featureMember>
57+
<ogr:points_wighted fid="points_wighted.7">
58+
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>6.90159574468085,0.40531914893617</gml:coordinates></gml:Point></ogr:geometryProperty>
59+
<ogr:id>5</ogr:id>
60+
</ogr:points_wighted>
61+
</gml:featureMember>
62+
<gml:featureMember>
63+
<ogr:points_wighted fid="points_wighted.8">
64+
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>9.09095744680851,-2.61063829787234</gml:coordinates></gml:Point></ogr:geometryProperty>
65+
<ogr:id>6</ogr:id>
66+
</ogr:points_wighted>
67+
</gml:featureMember>
68+
<gml:featureMember>
69+
<ogr:points_wighted fid="points_wighted.9">
70+
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>5.04734042553191,4.22553191489362</gml:coordinates></gml:Point></ogr:geometryProperty>
71+
<ogr:id>8</ogr:id>
72+
</ogr:points_wighted>
73+
</gml:featureMember>
74+
</ogr:FeatureCollection>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<GMLFeatureClassList>
2+
<GMLFeatureClass>
3+
<Name>count_points_weighted</Name>
4+
<ElementPath>count_points_weighted</ElementPath>
5+
<!--POLYGON-->
6+
<GeometryType>3</GeometryType>
7+
<SRSName>EPSG:4326</SRSName>
8+
<DatasetSpecificInfo>
9+
<FeatureCount>6</FeatureCount>
10+
<ExtentXMin>-1.00000</ExtentXMin>
11+
<ExtentXMax>10.00000</ExtentXMax>
12+
<ExtentYMin>-3.00000</ExtentYMin>
13+
<ExtentYMax>6.00000</ExtentYMax>
14+
</DatasetSpecificInfo>
15+
<PropertyDefn>
16+
<Name>name</Name>
17+
<ElementPath>name</ElementPath>
18+
<Type>String</Type>
19+
<Width>5</Width>
20+
</PropertyDefn>
21+
<PropertyDefn>
22+
<Name>intval</Name>
23+
<ElementPath>intval</ElementPath>
24+
<Type>Integer</Type>
25+
</PropertyDefn>
26+
<PropertyDefn>
27+
<Name>floatval</Name>
28+
<ElementPath>floatval</ElementPath>
29+
<Type>Real</Type>
30+
</PropertyDefn>
31+
<PropertyDefn>
32+
<Name>NUMPOINTS</Name>
33+
<ElementPath>NUMPOINTS</ElementPath>
34+
<Type>Integer</Type>
35+
</PropertyDefn>
36+
</GMLFeatureClass>
37+
</GMLFeatureClassList>
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<ogr:FeatureCollection
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation=""
5+
xmlns:ogr="http://ogr.maptools.org/"
6+
xmlns:gml="http://www.opengis.net/gml">
7+
<gml:boundedBy>
8+
<gml:Box>
9+
<gml:coord><gml:X>-1</gml:X><gml:Y>-3</gml:Y></gml:coord>
10+
<gml:coord><gml:X>10</gml:X><gml:Y>6</gml:Y></gml:coord>
11+
</gml:Box>
12+
</gml:boundedBy>
13+
14+
<gml:featureMember>
15+
<ogr:count_points_weighted fid="polys.0">
16+
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-1,-1 -1,3 3,3 3,2 2,2 2,-1 -1,-1</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
17+
<ogr:name>aaaaa</ogr:name>
18+
<ogr:intval>33</ogr:intval>
19+
<ogr:floatval>44.123456</ogr:floatval>
20+
<ogr:NUMPOINTS>20</ogr:NUMPOINTS>
21+
</ogr:count_points_weighted>
22+
</gml:featureMember>
23+
<gml:featureMember>
24+
<ogr:count_points_weighted fid="polys.1">
25+
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>5,5 6,4 4,4 5,5</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
26+
<ogr:name>Aaaaa</ogr:name>
27+
<ogr:intval>-33</ogr:intval>
28+
<ogr:floatval>0</ogr:floatval>
29+
<ogr:NUMPOINTS>8</ogr:NUMPOINTS>
30+
</ogr:count_points_weighted>
31+
</gml:featureMember>
32+
<gml:featureMember>
33+
<ogr:count_points_weighted fid="polys.2">
34+
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>2,5 2,6 3,6 3,5 2,5</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
35+
<ogr:name>bbaaa</ogr:name>
36+
<ogr:floatval>0.123</ogr:floatval>
37+
<ogr:NUMPOINTS>0</ogr:NUMPOINTS>
38+
</ogr:count_points_weighted>
39+
</gml:featureMember>
40+
<gml:featureMember>
41+
<ogr:count_points_weighted fid="polys.3">
42+
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>6,1 10,1 10,-3 6,-3 6,1</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs><gml:innerBoundaryIs><gml:LinearRing><gml:coordinates>7,0 7,-2 9,-2 9,0 7,0</gml:coordinates></gml:LinearRing></gml:innerBoundaryIs></gml:Polygon></ogr:geometryProperty>
43+
<ogr:name>ASDF</ogr:name>
44+
<ogr:intval>0</ogr:intval>
45+
<ogr:NUMPOINTS>11</ogr:NUMPOINTS>
46+
</ogr:count_points_weighted>
47+
</gml:featureMember>
48+
<gml:featureMember>
49+
<ogr:count_points_weighted fid="polys.4">
50+
<ogr:intval>120</ogr:intval>
51+
<ogr:floatval>-100291.43213</ogr:floatval>
52+
<ogr:NUMPOINTS>0</ogr:NUMPOINTS>
53+
</ogr:count_points_weighted>
54+
</gml:featureMember>
55+
<gml:featureMember>
56+
<ogr:count_points_weighted fid="polys.5">
57+
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>3,2 6,1 6,-3 2,-1 2,2 3,2</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
58+
<ogr:name>elim</ogr:name>
59+
<ogr:intval>2</ogr:intval>
60+
<ogr:floatval>3.33</ogr:floatval>
61+
<ogr:NUMPOINTS>9</ogr:NUMPOINTS>
62+
</ogr:count_points_weighted>
63+
</gml:featureMember>
64+
</ogr:FeatureCollection>

‎python/plugins/processing/tests/testdata/qgis_algorithm_tests.yaml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2147,7 +2147,7 @@ tests:
21472147
results: {}
21482148

21492149
- algorithm: qgis:countuniquepointsinpolygon
2150-
name: Test (qgis:countuniquepointsinpolygon)
2150+
name: standard count unique points in polygon
21512151
params:
21522152
CLASSFIELD: id2
21532153
FIELD: NUMPOINTS
@@ -2161,3 +2161,19 @@ tests:
21612161
OUTPUT:
21622162
name: expected/count_unique_points.gml
21632163
type: vector
2164+
2165+
- algorithm: qgis:countpointsinpolygonweighted
2166+
name: standard count points in polygon wighted
2167+
params:
2168+
FIELD: NUMPOINTS
2169+
POINTS:
2170+
name: custom/points_weighted.gml
2171+
type: vector
2172+
POLYGONS:
2173+
name: polys.gml
2174+
type: vector
2175+
WEIGHT: id
2176+
results:
2177+
OUTPUT:
2178+
name: expected/count_points_weighted.gml
2179+
type: vector

0 commit comments

Comments
 (0)
Please sign in to comment.