Skip to content

Commit

Permalink
added sample test script which calls two algorithms
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy committed Mar 16, 2017
1 parent a70e73c commit c4052e6
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 0 deletions.
@@ -0,0 +1,26 @@
<GMLFeatureClassList>
<GMLFeatureClass>
<Name>selected_points</Name>
<ElementPath>selected_points</ElementPath>
<!--POINT-->
<GeometryType>1</GeometryType>
<SRSName>EPSG:4326</SRSName>
<DatasetSpecificInfo>
<FeatureCount>2</FeatureCount>
<ExtentXMin>1.00000</ExtentXMin>
<ExtentXMax>5.00000</ExtentXMax>
<ExtentYMin>1.00000</ExtentYMin>
<ExtentYMax>2.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>1</gml:X><gml:Y>1</gml:Y></gml:coord>
<gml:coord><gml:X>5</gml:X><gml:Y>2</gml:Y></gml:coord>
</gml:Box>
</gml:boundedBy>

<gml:featureMember>
<ogr:selected_points fid="points.0">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>1,1</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:id>1</ogr:id>
<ogr:id2>2</ogr:id2>
</ogr:selected_points>
</gml:featureMember>
<gml:featureMember>
<ogr:selected_points fid="points.3">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>5,2</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:id>4</ogr:id>
<ogr:id2>2</ogr:id2>
</ogr:selected_points>
</gml:featureMember>
</ogr:FeatureCollection>
Expand Up @@ -14,3 +14,14 @@ tests:
compare:
geometry:
precision: 7

- algorithm: script:selectbyattribute
name: Select by attribute
params:
INPUT_LAYER:
name: points.gml
type: vector
results:
OUTPUT_LAYER:
name: expected/selected_points.gml
type: vector
@@ -0,0 +1,16 @@
##Select by attribute=name
##Tests=group
##INPUT_LAYER=vector
##OUTPUT_LAYER=output vector

import processing

result = processing.runalg("qgis:selectbyattribute",
INPUT_LAYER,
"id2",
0,
"2")

processing.runalg("qgis:saveselectedfeatures",
result["OUTPUT"],
OUTPUT_LAYER)

0 comments on commit c4052e6

Please sign in to comment.