Skip to content

Commit 6a760ef

Browse files
committed
More tests for Extract by Location
1 parent e002660 commit 6a760ef

7 files changed

+223
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<GMLFeatureClassList>
2+
<GMLFeatureClass>
3+
<Name>extract_by_location_contains</Name>
4+
<ElementPath>extract_by_location_contains</ElementPath>
5+
<!--POLYGON-->
6+
<GeometryType>3</GeometryType>
7+
<SRSName>EPSG:4326</SRSName>
8+
<DatasetSpecificInfo>
9+
<FeatureCount>2</FeatureCount>
10+
<ExtentXMin>-1.00000</ExtentXMin>
11+
<ExtentXMax>6.00000</ExtentXMax>
12+
<ExtentYMin>-3.00000</ExtentYMin>
13+
<ExtentYMax>3.00000</ExtentYMax>
14+
</DatasetSpecificInfo>
15+
<PropertyDefn>
16+
<Name>name</Name>
17+
<ElementPath>name</ElementPath>
18+
<Type>String</Type>
19+
<Width>5</Width>
20+
</PropertyDefn>
21+
<PropertyDefn>
22+
<Name>intval</Name>
23+
<ElementPath>intval</ElementPath>
24+
<Type>Integer</Type>
25+
</PropertyDefn>
26+
<PropertyDefn>
27+
<Name>floatval</Name>
28+
<ElementPath>floatval</ElementPath>
29+
<Type>Real</Type>
30+
</PropertyDefn>
31+
</GMLFeatureClass>
32+
</GMLFeatureClassList>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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>-1</gml:X><gml:Y>-3</gml:Y></gml:coord>
10+
<gml:coord><gml:X>6</gml:X><gml:Y>3</gml:Y></gml:coord>
11+
</gml:Box>
12+
</gml:boundedBy>
13+
14+
<gml:featureMember>
15+
<ogr:extract_by_location_contains fid="polys.0">
16+
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-1,-1 -1,3 3,3 3,2 2,2 2,-1 -1,-1</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
17+
<ogr:name>aaaaa</ogr:name>
18+
<ogr:intval>33</ogr:intval>
19+
<ogr:floatval>44.123456</ogr:floatval>
20+
</ogr:extract_by_location_contains>
21+
</gml:featureMember>
22+
<gml:featureMember>
23+
<ogr:extract_by_location_contains fid="polys.5">
24+
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>3,2 6,1 6,-3 2,-1 2,2 3,2</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
25+
<ogr:name>elim</ogr:name>
26+
<ogr:intval>2</ogr:intval>
27+
<ogr:floatval>3.33</ogr:floatval>
28+
</ogr:extract_by_location_contains>
29+
</gml:featureMember>
30+
</ogr:FeatureCollection>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<GMLFeatureClassList>
2+
<GMLFeatureClass>
3+
<Name>extract_by_location_disjoint</Name>
4+
<ElementPath>extract_by_location_disjoint</ElementPath>
5+
<!--POINT-->
6+
<GeometryType>1</GeometryType>
7+
<SRSName>EPSG:4326</SRSName>
8+
<DatasetSpecificInfo>
9+
<FeatureCount>3</FeatureCount>
10+
<ExtentXMin>0.00000</ExtentXMin>
11+
<ExtentXMax>8.00000</ExtentXMax>
12+
<ExtentYMin>-5.00000</ExtentYMin>
13+
<ExtentYMax>2.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>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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>-5</gml:Y></gml:coord>
10+
<gml:coord><gml:X>8</gml:X><gml:Y>2</gml:Y></gml:coord>
11+
</gml:Box>
12+
</gml:boundedBy>
13+
14+
<gml:featureMember>
15+
<ogr:extract_by_location_disjoint fid="points.3">
16+
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>5,2</gml:coordinates></gml:Point></ogr:geometryProperty>
17+
<ogr:id>4</ogr:id>
18+
<ogr:id2>2</ogr:id2>
19+
</ogr:extract_by_location_disjoint>
20+
</gml:featureMember>
21+
<gml:featureMember>
22+
<ogr:extract_by_location_disjoint fid="points.6">
23+
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>8,-1</gml:coordinates></gml:Point></ogr:geometryProperty>
24+
<ogr:id>7</ogr:id>
25+
<ogr:id2>0</ogr:id2>
26+
</ogr:extract_by_location_disjoint>
27+
</gml:featureMember>
28+
<gml:featureMember>
29+
<ogr:extract_by_location_disjoint fid="points.5">
30+
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>0,-5</gml:coordinates></gml:Point></ogr:geometryProperty>
31+
<ogr:id>6</ogr:id>
32+
<ogr:id2>0</ogr:id2>
33+
</ogr:extract_by_location_disjoint>
34+
</gml:featureMember>
35+
</ogr:FeatureCollection>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<GMLFeatureClassList>
2+
<GMLFeatureClass>
3+
<Name>extract_by_location_touches</Name>
4+
<ElementPath>extract_by_location_touches</ElementPath>
5+
<!--POINT-->
6+
<GeometryType>1</GeometryType>
7+
<SRSName>EPSG:4326</SRSName>
8+
<DatasetSpecificInfo>
9+
<FeatureCount>4</FeatureCount>
10+
<ExtentXMin>0.00000</ExtentXMin>
11+
<ExtentXMax>7.00000</ExtentXMax>
12+
<ExtentYMin>-1.00000</ExtentYMin>
13+
<ExtentYMax>3.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>
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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>3</gml:Y></gml:coord>
11+
</gml:Box>
12+
</gml:boundedBy>
13+
14+
<gml:featureMember>
15+
<ogr:extract_by_location_touches fid="points.1">
16+
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>3,3</gml:coordinates></gml:Point></ogr:geometryProperty>
17+
<ogr:id>2</ogr:id>
18+
<ogr:id2>1</ogr:id2>
19+
</ogr:extract_by_location_touches>
20+
</gml:featureMember>
21+
<gml:featureMember>
22+
<ogr:extract_by_location_touches fid="points.2">
23+
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>2,2</gml:coordinates></gml:Point></ogr:geometryProperty>
24+
<ogr:id>3</ogr:id>
25+
<ogr:id2>0</ogr:id2>
26+
</ogr:extract_by_location_touches>
27+
</gml:featureMember>
28+
<gml:featureMember>
29+
<ogr:extract_by_location_touches fid="points.8">
30+
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>0,-1</gml:coordinates></gml:Point></ogr:geometryProperty>
31+
<ogr:id>9</ogr:id>
32+
<ogr:id2>0</ogr:id2>
33+
</ogr:extract_by_location_touches>
34+
</gml:featureMember>
35+
<gml:featureMember>
36+
<ogr:extract_by_location_touches fid="points.7">
37+
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>7,-1</gml:coordinates></gml:Point></ogr:geometryProperty>
38+
<ogr:id>8</ogr:id>
39+
<ogr:id2>0</ogr:id2>
40+
</ogr:extract_by_location_touches>
41+
</gml:featureMember>
42+
</ogr:FeatureCollection>

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

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3022,6 +3022,38 @@ tests:
30223022
name: expected/extract_by_location_contains.gml
30233023
type: vector
30243024

3025+
- algorithm: native:extractbylocation
3026+
name: Extract by location (disjoint)
3027+
params:
3028+
INPUT:
3029+
name: custom/points.shp
3030+
type: vector
3031+
INTERSECT:
3032+
name: polys.gml
3033+
type: vector
3034+
PREDICATE:
3035+
- 2
3036+
results:
3037+
OUTPUT:
3038+
name: expected/extract_by_location_disjoint.gml
3039+
type: vector
3040+
3041+
- algorithm: native:extractbylocation
3042+
name: Extract by location (touches)
3043+
params:
3044+
INPUT:
3045+
name: custom/points.shp
3046+
type: vector
3047+
INTERSECT:
3048+
name: polys.gml
3049+
type: vector
3050+
PREDICATE:
3051+
- 4
3052+
results:
3053+
OUTPUT:
3054+
name: expected/extract_by_location_touches.gml
3055+
type: vector
3056+
30253057

30263058
- algorithm: qgis:addfieldtoattributestable
30273059
name: add float field

0 commit comments

Comments
 (0)