Skip to content

Commit

Permalink
Merge pull request #4307 from ghtmtt/proc_tests
Browse files Browse the repository at this point in the history
[processing] other qgis test, clean commit
  • Loading branch information
m-kuhn committed May 10, 2017
2 parents 8423aaf + 01f647e commit aa021be
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 1 deletion.
@@ -0,0 +1,26 @@
<GMLFeatureClassList>
<GMLFeatureClass>
<Name>select_by_expression</Name>
<ElementPath>select_by_expression</ElementPath>
<!--POINT-->
<GeometryType>1</GeometryType>
<SRSName>EPSG:4326</SRSName>
<DatasetSpecificInfo>
<FeatureCount>2</FeatureCount>
<ExtentXMin>0.00000</ExtentXMin>
<ExtentXMax>7.00000</ExtentXMax>
<ExtentYMin>-1.00000</ExtentYMin>
<ExtentYMax>-1.00000</ExtentYMax>
</DatasetSpecificInfo>
<PropertyDefn>
<Name>id</Name>
<ElementPath>id</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
<PropertyDefn>
<Name>id2</Name>
<ElementPath>id2</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
</GMLFeatureClass>
</GMLFeatureClassList>
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=""
xmlns:ogr="http://ogr.maptools.org/"
xmlns:gml="http://www.opengis.net/gml">
<gml:boundedBy>
<gml:Box>
<gml:coord><gml:X>0</gml:X><gml:Y>-1</gml:Y></gml:coord>
<gml:coord><gml:X>7</gml:X><gml:Y>-1</gml:Y></gml:coord>
</gml:Box>
</gml:boundedBy>

<gml:featureMember>
<ogr:select_by_expression fid="points.8">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>0,-1</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:id>9</ogr:id>
<ogr:id2>0</ogr:id2>
</ogr:select_by_expression>
</gml:featureMember>
<gml:featureMember>
<ogr:select_by_expression fid="points.7">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>7,-1</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:id>8</ogr:id>
<ogr:id2>0</ogr:id2>
</ogr:select_by_expression>
</gml:featureMember>
</ogr:FeatureCollection>
Expand Up @@ -2554,4 +2554,35 @@ tests:
results:
OUTPUT_LAYER:
name: expected/selected_points.gml
type: vector
type: vector

- algorithm: script:selectbyexpression
name: Select by expression
params:
INPUT_LAYER:
name: points.gml
type: vector
results:
OUTPUT_LAYER:
name: expected/select_by_expression.gml
type: vector

- algorithm: qgis:randomextract
name: Random extract by number
params:
INPUT:
name: custom/points_weighted.gml
type: vector
METHOD: '0'
NUMBER: 4
results: {}

- algorithm: qgis:randomextract
name: Random extract by percentage
params:
INPUT:
name: custom/points_weighted.gml
type: vector
METHOD: '1'
NUMBER: 50
results: {}
@@ -0,0 +1,15 @@
##Select by expression=name
##Tests=group
##INPUT_LAYER=vector
##OUTPUT_LAYER=output vector

import processing

result = processing.run("qgis:selectbyexpression",
INPUT_LAYER,
'"id2" = 0 and "id" > 7',
"1")

processing.run("qgis:saveselectedfeatures",
result["RESULT"],
OUTPUT_LAYER)

0 comments on commit aa021be

Please sign in to comment.