Skip to content

Commit e56da0e

Browse files
Add test for Join by location (equals)
Adds a test for "Join attributes by location" processing algorithm 'equals' predicate
1 parent afcf048 commit e56da0e

File tree

5 files changed

+198
-0
lines changed

5 files changed

+198
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<ogr:FeatureCollection
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://ogr.maptools.org/ polys_2.xsd"
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>10</gml:X><gml:Y>6.5</gml:Y></gml:coord>
11+
</gml:Box>
12+
</gml:boundedBy>
13+
14+
<gml:featureMember>
15+
<ogr:polys_2 fid="polys_2.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:innerBoundaryIs><gml:LinearRing><gml:coordinates>-0.5,1.5 1.5,1.5 1.5,-0.5 -0.5,-0.5 -0.5,1.5</gml:coordinates></gml:LinearRing></gml:innerBoundaryIs></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:polys_2>
21+
</gml:featureMember>
22+
<gml:featureMember>
23+
<ogr:polys_2 fid="polys_2.1">
24+
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>5.70060344827592,5.27698275862071 6.70060344827592,4.27698275862071 4.70060344827592,4.27698275862071 5.70060344827592,5.27698275862071</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
25+
<ogr:name>Aaaaa</ogr:name>
26+
<ogr:intval xsi:nil="true"/>
27+
<ogr:floatval>0</ogr:floatval>
28+
</ogr:polys_2>
29+
</gml:featureMember>
30+
<gml:featureMember>
31+
<ogr:polys_2 fid="polys_2.2">
32+
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>2.2,5.2 2.2,5.8 2.8,5.8 2.8,5.2 2.2,5.2</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
33+
<ogr:name>bbaaa</ogr:name>
34+
<ogr:intval xsi:nil="true"/>
35+
<ogr:floatval>0.123</ogr:floatval>
36+
</ogr:polys_2>
37+
</gml:featureMember>
38+
<gml:featureMember>
39+
<ogr:polys_2 fid="polys_2.3">
40+
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>6,1 10,1 10,-3 6,-3 6,1</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs><gml:innerBoundaryIs><gml:LinearRing><gml:coordinates>7,0 7,-2 9,-2 9,0 7,0</gml:coordinates></gml:LinearRing></gml:innerBoundaryIs></gml:Polygon></ogr:geometryProperty>
41+
<ogr:name>ASDF</ogr:name>
42+
<ogr:intval>0</ogr:intval>
43+
<ogr:floatval xsi:nil="true"/>
44+
</ogr:polys_2>
45+
</gml:featureMember>
46+
<gml:featureMember>
47+
<ogr:polys_2 fid="polys_2.4">
48+
<ogr:name xsi:nil="true"/>
49+
<ogr:intval>120</ogr:intval>
50+
<ogr:floatval>-100291.43213</ogr:floatval>
51+
</ogr:polys_2>
52+
</gml:featureMember>
53+
<gml:featureMember>
54+
<ogr:polys_2 fid="polys_2.5">
55+
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>1.5,6.5 3.5,6.5 3.5,4.5 1.5,4.5 1.5,6.5</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs><gml:innerBoundaryIs><gml:LinearRing><gml:coordinates>1.8,6.2 3.2,6.2 3.2,4.8 1.8,4.8 1.8,6.2</gml:coordinates></gml:LinearRing></gml:innerBoundaryIs></gml:Polygon></ogr:geometryProperty>
56+
<ogr:name>ghgd4</ogr:name>
57+
<ogr:intval>15</ogr:intval>
58+
<ogr:floatval>6.3</ogr:floatval>
59+
</ogr:polys_2>
60+
</gml:featureMember>
61+
</ogr:FeatureCollection>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<xs:schema targetNamespace="http://ogr.maptools.org/" xmlns:ogr="http://ogr.maptools.org/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:gml="http://www.opengis.net/gml" elementFormDefault="qualified" version="1.0">
3+
<xs:import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengis.net/gml/2.1.2/feature.xsd"/>
4+
<xs:element name="FeatureCollection" type="ogr:FeatureCollectionType" substitutionGroup="gml:_FeatureCollection"/>
5+
<xs:complexType name="FeatureCollectionType">
6+
<xs:complexContent>
7+
<xs:extension base="gml:AbstractFeatureCollectionType">
8+
<xs:attribute name="lockId" type="xs:string" use="optional"/>
9+
<xs:attribute name="scope" type="xs:string" use="optional"/>
10+
</xs:extension>
11+
</xs:complexContent>
12+
</xs:complexType>
13+
<xs:element name="polys_2" type="ogr:polys_2_Type" substitutionGroup="gml:_Feature"/>
14+
<xs:complexType name="polys_2_Type">
15+
<xs:complexContent>
16+
<xs:extension base="gml:AbstractFeatureType">
17+
<xs:sequence>
18+
<xs:element name="geometryProperty" type="gml:PolygonPropertyType" nillable="true" minOccurs="0" maxOccurs="1"/>
19+
<xs:element name="name" nillable="true" minOccurs="0" maxOccurs="1">
20+
<xs:simpleType>
21+
<xs:restriction base="xs:string">
22+
<xs:maxLength value="255"/>
23+
</xs:restriction>
24+
</xs:simpleType>
25+
</xs:element>
26+
<xs:element name="intval" nillable="true" minOccurs="0" maxOccurs="1">
27+
<xs:simpleType>
28+
<xs:restriction base="xs:integer">
29+
<xs:totalDigits value="10"/>
30+
</xs:restriction>
31+
</xs:simpleType>
32+
</xs:element>
33+
<xs:element name="floatval" nillable="true" minOccurs="0" maxOccurs="1">
34+
<xs:simpleType>
35+
<xs:restriction base="xs:decimal">
36+
</xs:restriction>
37+
</xs:simpleType>
38+
</xs:element>
39+
</xs:sequence>
40+
</xs:extension>
41+
</xs:complexContent>
42+
</xs:complexType>
43+
</xs:schema>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<ogr:FeatureCollection
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://ogr.maptools.org/ join_by_location_equals.xsd"
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>6</gml:X><gml:Y>-3</gml:Y></gml:coord>
10+
<gml:coord><gml:X>10</gml:X><gml:Y>1</gml:Y></gml:coord>
11+
</gml:Box>
12+
</gml:boundedBy>
13+
14+
<gml:featureMember>
15+
<ogr:join_by_location_equals fid="polys.3">
16+
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>6,1 10,1 10,-3 6,-3 6,1</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs><gml:innerBoundaryIs><gml:LinearRing><gml:coordinates>7,0 7,-2 9,-2 9,0 7,0</gml:coordinates></gml:LinearRing></gml:innerBoundaryIs></gml:Polygon></ogr:geometryProperty>
17+
<ogr:name>ASDF</ogr:name>
18+
<ogr:intval>0</ogr:intval>
19+
<ogr:floatval xsi:nil="true"/>
20+
<ogr:J_fid>polys_2.3</ogr:J_fid>
21+
</ogr:join_by_location_equals>
22+
</gml:featureMember>
23+
</ogr:FeatureCollection>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<xs:schema targetNamespace="http://ogr.maptools.org/" xmlns:ogr="http://ogr.maptools.org/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:gml="http://www.opengis.net/gml" elementFormDefault="qualified" version="1.0">
3+
<xs:import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengis.net/gml/2.1.2/feature.xsd"/>
4+
<xs:element name="FeatureCollection" type="ogr:FeatureCollectionType" substitutionGroup="gml:_FeatureCollection"/>
5+
<xs:complexType name="FeatureCollectionType">
6+
<xs:complexContent>
7+
<xs:extension base="gml:AbstractFeatureCollectionType">
8+
<xs:attribute name="lockId" type="xs:string" use="optional"/>
9+
<xs:attribute name="scope" type="xs:string" use="optional"/>
10+
</xs:extension>
11+
</xs:complexContent>
12+
</xs:complexType>
13+
<xs:element name="join_by_location_equals" type="ogr:join_by_location_equals_Type" substitutionGroup="gml:_Feature"/>
14+
<xs:complexType name="join_by_location_equals_Type">
15+
<xs:complexContent>
16+
<xs:extension base="gml:AbstractFeatureType">
17+
<xs:sequence>
18+
<xs:element name="geometryProperty" type="gml:PolygonPropertyType" nillable="true" minOccurs="0" maxOccurs="1"/>
19+
<xs:element name="name" nillable="true" minOccurs="0" maxOccurs="1">
20+
<xs:simpleType>
21+
<xs:restriction base="xs:string">
22+
<xs:maxLength value="5"/>
23+
</xs:restriction>
24+
</xs:simpleType>
25+
</xs:element>
26+
<xs:element name="intval" nillable="true" minOccurs="0" maxOccurs="1">
27+
<xs:simpleType>
28+
<xs:restriction base="xs:integer">
29+
<xs:totalDigits value="10"/>
30+
</xs:restriction>
31+
</xs:simpleType>
32+
</xs:element>
33+
<xs:element name="floatval" nillable="true" minOccurs="0" maxOccurs="1">
34+
<xs:simpleType>
35+
<xs:restriction base="xs:decimal">
36+
</xs:restriction>
37+
</xs:simpleType>
38+
</xs:element>
39+
<xs:element name="J_fid" nillable="true" minOccurs="0" maxOccurs="1">
40+
<xs:simpleType>
41+
<xs:restriction base="xs:string">
42+
<xs:maxLength value="255"/>
43+
</xs:restriction>
44+
</xs:simpleType>
45+
</xs:element>
46+
</xs:sequence>
47+
</xs:extension>
48+
</xs:complexContent>
49+
</xs:complexType>
50+
</xs:schema>

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

+21
Original file line numberDiff line numberDiff line change
@@ -4757,6 +4757,27 @@ tests:
47574757
name: expected/join_by_location_unjoinable.gml
47584758
type: vector
47594759

4760+
- algorithm: qgis:joinattributesbylocation
4761+
name: Join by location (equals)
4762+
params:
4763+
DISCARD_NONMATCHING: true
4764+
INPUT:
4765+
name: polys.gml
4766+
type: vector
4767+
JOIN:
4768+
name: custom/polys_2.gml
4769+
type: vector
4770+
JOIN_FIELDS:
4771+
- fid
4772+
METHOD: 0
4773+
PREDICATE:
4774+
- 2
4775+
PREFIX: J_
4776+
results:
4777+
OUTPUT:
4778+
name: expected/join_by_location_equals.gml
4779+
type: vector
4780+
47604781
- algorithm: qgis:joinbylocationsummary
47614782
name: Join by location (summary), intersects
47624783
params:

0 commit comments

Comments
 (0)