mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -04:00
added sample test script which calls two algorithms
This commit is contained in:
parent
a70e73cd74
commit
c4052e6ec4
26
python/plugins/processing/tests/testdata/expected/selected_points.gfs
vendored
Normal file
26
python/plugins/processing/tests/testdata/expected/selected_points.gfs
vendored
Normal file
@ -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>
|
28
python/plugins/processing/tests/testdata/expected/selected_points.gml
vendored
Normal file
28
python/plugins/processing/tests/testdata/expected/selected_points.gml
vendored
Normal file
@ -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>
|
@ -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
|
||||
|
16
python/plugins/processing/tests/testdata/scripts/selectbyattribute.py
vendored
Normal file
16
python/plugins/processing/tests/testdata/scripts/selectbyattribute.py
vendored
Normal file
@ -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)
|
Loading…
x
Reference in New Issue
Block a user