Skip to content

Commit a289eb1

Browse files
committed
[processing] other qgis test, clean commit
1 parent 4d8df75 commit a289eb1

File tree

4 files changed

+117
-1
lines changed

4 files changed

+117
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<GMLFeatureClassList>
2+
<GMLFeatureClass>
3+
<Name>select_by_expression</Name>
4+
<ElementPath>select_by_expression</ElementPath>
5+
<!--POINT-->
6+
<GeometryType>1</GeometryType>
7+
<SRSName>EPSG:4326</SRSName>
8+
<DatasetSpecificInfo>
9+
<FeatureCount>2</FeatureCount>
10+
<ExtentXMin>0.00000</ExtentXMin>
11+
<ExtentXMax>7.00000</ExtentXMax>
12+
<ExtentYMin>-1.00000</ExtentYMin>
13+
<ExtentYMax>-1.00000</ExtentYMax>
14+
</DatasetSpecificInfo>
15+
<PropertyDefn>
16+
<Name>id</Name>
17+
<ElementPath>id</ElementPath>
18+
<Type>Integer</Type>
19+
</PropertyDefn>
20+
<PropertyDefn>
21+
<Name>id2</Name>
22+
<ElementPath>id2</ElementPath>
23+
<Type>Integer</Type>
24+
</PropertyDefn>
25+
</GMLFeatureClass>
26+
</GMLFeatureClassList>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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</gml:X><gml:Y>-1</gml:Y></gml:coord>
10+
<gml:coord><gml:X>7</gml:X><gml:Y>-1</gml:Y></gml:coord>
11+
</gml:Box>
12+
</gml:boundedBy>
13+
14+
<gml:featureMember>
15+
<ogr:select_by_expression fid="points.8">
16+
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>0,-1</gml:coordinates></gml:Point></ogr:geometryProperty>
17+
<ogr:id>9</ogr:id>
18+
<ogr:id2>0</ogr:id2>
19+
</ogr:select_by_expression>
20+
</gml:featureMember>
21+
<gml:featureMember>
22+
<ogr:select_by_expression fid="points.7">
23+
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>7,-1</gml:coordinates></gml:Point></ogr:geometryProperty>
24+
<ogr:id>8</ogr:id>
25+
<ogr:id2>0</ogr:id2>
26+
</ogr:select_by_expression>
27+
</gml:featureMember>
28+
</ogr:FeatureCollection>

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

+48-1
Original file line numberDiff line numberDiff line change
@@ -2538,4 +2538,51 @@ tests:
25382538
results:
25392539
OUTPUT_LAYER:
25402540
name: expected/selected_points.gml
2541-
type: vector
2541+
type: vector
2542+
2543+
- algorithm: script:selectbyexpression
2544+
name: Select by expression
2545+
params:
2546+
INPUT_LAYER:
2547+
name: points.gml
2548+
type: vector
2549+
results:
2550+
OUTPUT_LAYER:
2551+
name: expected/select_by_expression.gml
2552+
type: vector
2553+
2554+
- algorithm: qgis:randomextract
2555+
name: Random extract by number
2556+
params:
2557+
INPUT:
2558+
name: custom/points_weighted.gml
2559+
type: vector
2560+
METHOD: '0'
2561+
NUMBER: 4
2562+
results: {}
2563+
2564+
- algorithm: qgis:randomextract
2565+
name: Random extract by percentage
2566+
params:
2567+
INPUT:
2568+
name: custom/points_weighted.gml
2569+
type: vector
2570+
METHOD: '1'
2571+
NUMBER: 50
2572+
results: {}
2573+
2574+
- algorithm: qgis:randomselection
2575+
name: Random Selection with point input
2576+
params:
2577+
INPUT_LAYER:
2578+
name: points.gml
2579+
type: vector
2580+
results: {}
2581+
2582+
- algorithm: qgis:randomselectionwithinsubsets
2583+
name: Random selection within subset
2584+
params:
2585+
INPUT_LAYER:
2586+
name: points.gml
2587+
type: vector
2588+
results: {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
##Select by expression=name
2+
##Tests=group
3+
##INPUT_LAYER=vector
4+
##OUTPUT_LAYER=output vector
5+
6+
import processing
7+
8+
result = processing.run("qgis:selectbyexpression",
9+
INPUT_LAYER,
10+
'"id2" = 0 and "id" > 7',
11+
"1")
12+
13+
processing.run("qgis:saveselectedfeatures",
14+
result["RESULT"],
15+
OUTPUT_LAYER)

0 commit comments

Comments
 (0)