Skip to content
Permalink
Browse files
[processing] other qgis test, clean commit
  • Loading branch information
ghtmtt committed Mar 27, 2017
1 parent 4d8df75 commit a289eb14fabc65aa90f8e183a94bba8c9a2413be
@@ -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>
@@ -2538,4 +2538,51 @@ 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: {}

- algorithm: qgis:randomselection
name: Random Selection with point input
params:
INPUT_LAYER:
name: points.gml
type: vector
results: {}

- algorithm: qgis:randomselectionwithinsubsets
name: Random selection within subset
params:
INPUT_LAYER:
name: points.gml
type: vector
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 a289eb1

Please sign in to comment.