Skip to content

Commit aa2b1e9

Browse files
committed
Add test for single layer union
1 parent ef145af commit aa2b1e9

File tree

4 files changed

+216
-0
lines changed

4 files changed

+216
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"type": "FeatureCollection",
3+
"name": "overlay0",
4+
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::3857" } },
5+
"features": [
6+
{ "type": "Feature", "properties": { "id_a": "A1" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 1.0, 1.0 ], [ 5.0, 1.0 ], [ 5.0, 5.0 ], [ 1.0, 5.0 ], [ 1.0, 1.0 ] ] ] } },
7+
{ "type": "Feature", "properties": { "id_a": "A2" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 2.0, 2.0 ], [ 4.0, 2.0 ], [ 4.0, 4.0 ], [ 2.0, 4.0 ], [ 2.0, 2.0 ] ] ] } },
8+
{ "type": "Feature", "properties": { "id_a": "A3" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 7.0, 2.0 ], [ 9.0, 2.0 ], [ 9.0, 4.0 ], [ 7.0, 4.0 ], [ 7.0, 2.0 ] ] ] } },
9+
{ "type": "Feature", "properties": { "id_a": "A4" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 6.0, 1.0 ], [ 10.0, 1.0 ], [ 10.0, 5.0 ], [ 6.0, 5.0 ], [ 6.0, 1.0 ] ] ] } },
10+
{ "type": "Feature", "properties": { "id_a": "A5" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 1.0, 6.0 ], [ 3.0, 6.0 ], [ 3.0, 10.0 ], [ 1.0, 10.0 ], [ 1.0, 6.0 ] ] ] } },
11+
{ "type": "Feature", "properties": { "id_a": "A6" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 3.0, 6.0 ], [ 5.0, 6.0 ], [ 5.0, 10.0 ], [ 3.0, 10.0 ], [ 3.0, 6.0 ] ] ] } },
12+
{ "type": "Feature", "properties": { "id_a": "A7" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 6.0, 6.0 ], [ 10.0, 6.0 ], [ 10.0, 10.0 ], [ 6.0, 10.0 ], [ 6.0, 6.0 ] ] ] } },
13+
{ "type": "Feature", "properties": { "id_a": "A8" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 1.0, 11.0 ], [ 4.0, 11.0 ], [ 4.0, 14.0 ], [ 1.0, 14.0 ], [ 1.0, 11.0 ] ] ] } },
14+
{ "type": "Feature", "properties": { "id_a": "A9" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 1.0, 13.0 ], [ 4.0, 13.0 ], [ 4.0, 16.0 ], [ 1.0, 16.0 ], [ 1.0, 13.0 ] ] ] } },
15+
{ "type": "Feature", "properties": { "id_a": "A10" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 2.0, 12.0 ], [ 5.0, 12.0 ], [ 5.0, 15.0 ], [ 2.0, 15.0 ], [ 2.0, 12.0 ] ] ] } },
16+
{ "type": "Feature", "properties": { "id_a": "A11" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 6.0, 11.0 ], [ 10.0, 11.0 ], [ 10.0, 12.0 ], [ 7.0, 12.0 ], [ 7.0, 15.0 ], [ 6.0, 15.0 ], [ 6.0, 11.0 ] ] ] } },
17+
{ "type": "Feature", "properties": { "id_a": "A12" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 8.0, 13.0 ], [ 10.0, 13.0 ], [ 10.0, 15.0 ], [ 8.0, 15.0 ], [ 8.0, 13.0 ] ] ] } }
18+
]
19+
}
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
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/ union0.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>1</gml:Y></gml:coord>
10+
<gml:coord><gml:X>10</gml:X><gml:Y>16</gml:Y></gml:coord>
11+
</gml:Box>
12+
</gml:boundedBy>
13+
14+
<gml:featureMember>
15+
<ogr:union0 fid="union0.0">
16+
<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:3857"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>2,2 2,4 4,4 4,2 2,2</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogr:geometryProperty>
17+
<ogr:id_a>A2</ogr:id_a>
18+
</ogr:union0>
19+
</gml:featureMember>
20+
<gml:featureMember>
21+
<ogr:union0 fid="union0.1">
22+
<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:3857"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>2,2 2,4 4,4 4,2 2,2</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogr:geometryProperty>
23+
<ogr:id_a>A1</ogr:id_a>
24+
</ogr:union0>
25+
</gml:featureMember>
26+
<gml:featureMember>
27+
<ogr:union0 fid="union0.2">
28+
<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:3857"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>1,1 1,5 5,5 5,1 1,1</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs><gml:innerBoundaryIs><gml:LinearRing><gml:coordinates>2,2 4,2 4,4 2,4 2,2</gml:coordinates></gml:LinearRing></gml:innerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogr:geometryProperty>
29+
<ogr:id_a>A1</ogr:id_a>
30+
</ogr:union0>
31+
</gml:featureMember>
32+
<gml:featureMember>
33+
<ogr:union0 fid="union0.3">
34+
<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:3857"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>7,2 7,4 9,4 9,2 7,2</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogr:geometryProperty>
35+
<ogr:id_a>A4</ogr:id_a>
36+
</ogr:union0>
37+
</gml:featureMember>
38+
<gml:featureMember>
39+
<ogr:union0 fid="union0.4">
40+
<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:3857"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>7,2 7,4 9,4 9,2 7,2</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogr:geometryProperty>
41+
<ogr:id_a>A3</ogr:id_a>
42+
</ogr:union0>
43+
</gml:featureMember>
44+
<gml:featureMember>
45+
<ogr:union0 fid="union0.5">
46+
<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:3857"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>2,13 1,13 1,14 2,14 2,13</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogr:geometryProperty>
47+
<ogr:id_a>A9</ogr:id_a>
48+
</ogr:union0>
49+
</gml:featureMember>
50+
<gml:featureMember>
51+
<ogr:union0 fid="union0.6">
52+
<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:3857"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>2,13 1,13 1,14 2,14 2,13</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogr:geometryProperty>
53+
<ogr:id_a>A8</ogr:id_a>
54+
</ogr:union0>
55+
</gml:featureMember>
56+
<gml:featureMember>
57+
<ogr:union0 fid="union0.7">
58+
<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:3857"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>6,1 6,5 10,5 10,1 6,1</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs><gml:innerBoundaryIs><gml:LinearRing><gml:coordinates>7,2 9,2 9,4 7,4 7,2</gml:coordinates></gml:LinearRing></gml:innerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogr:geometryProperty>
59+
<ogr:id_a>A4</ogr:id_a>
60+
</ogr:union0>
61+
</gml:featureMember>
62+
<gml:featureMember>
63+
<ogr:union0 fid="union0.8">
64+
<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:3857"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>4,12 2,12 2,13 4,13 4,12</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogr:geometryProperty>
65+
<ogr:id_a>A10</ogr:id_a>
66+
</ogr:union0>
67+
</gml:featureMember>
68+
<gml:featureMember>
69+
<ogr:union0 fid="union0.9">
70+
<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:3857"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>4,12 2,12 2,13 4,13 4,12</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogr:geometryProperty>
71+
<ogr:id_a>A8</ogr:id_a>
72+
</ogr:union0>
73+
</gml:featureMember>
74+
<gml:featureMember>
75+
<ogr:union0 fid="union0.10">
76+
<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:3857"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>1,6 3,6 3,10 1,10 1,6</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogr:geometryProperty>
77+
<ogr:id_a>A5</ogr:id_a>
78+
</ogr:union0>
79+
</gml:featureMember>
80+
<gml:featureMember>
81+
<ogr:union0 fid="union0.11">
82+
<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:3857"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>2,13 2,14 4,14 4,13 2,13</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogr:geometryProperty>
83+
<ogr:id_a>A10</ogr:id_a>
84+
</ogr:union0>
85+
</gml:featureMember>
86+
<gml:featureMember>
87+
<ogr:union0 fid="union0.12">
88+
<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:3857"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>2,13 2,14 4,14 4,13 2,13</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogr:geometryProperty>
89+
<ogr:id_a>A9</ogr:id_a>
90+
</ogr:union0>
91+
</gml:featureMember>
92+
<gml:featureMember>
93+
<ogr:union0 fid="union0.13">
94+
<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:3857"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>2,13 2,14 4,14 4,13 2,13</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogr:geometryProperty>
95+
<ogr:id_a>A8</ogr:id_a>
96+
</ogr:union0>
97+
</gml:featureMember>
98+
<gml:featureMember>
99+
<ogr:union0 fid="union0.14">
100+
<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:3857"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>3,6 5,6 5,10 3,10 3,6</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogr:geometryProperty>
101+
<ogr:id_a>A6</ogr:id_a>
102+
</ogr:union0>
103+
</gml:featureMember>
104+
<gml:featureMember>
105+
<ogr:union0 fid="union0.15">
106+
<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:3857"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>2,14 2,15 4,15 4,14 2,14</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogr:geometryProperty>
107+
<ogr:id_a>A10</ogr:id_a>
108+
</ogr:union0>
109+
</gml:featureMember>
110+
<gml:featureMember>
111+
<ogr:union0 fid="union0.16">
112+
<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:3857"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>2,14 2,15 4,15 4,14 2,14</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogr:geometryProperty>
113+
<ogr:id_a>A9</ogr:id_a>
114+
</ogr:union0>
115+
</gml:featureMember>
116+
<gml:featureMember>
117+
<ogr:union0 fid="union0.17">
118+
<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:3857"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>6,6 10,6 10,10 6,10 6,6</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogr:geometryProperty>
119+
<ogr:id_a>A7</ogr:id_a>
120+
</ogr:union0>
121+
</gml:featureMember>
122+
<gml:featureMember>
123+
<ogr:union0 fid="union0.18">
124+
<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:3857"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>4,12 4,11 1,11 1,13 2,13 2,12 4,12</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogr:geometryProperty>
125+
<ogr:id_a>A8</ogr:id_a>
126+
</ogr:union0>
127+
</gml:featureMember>
128+
<gml:featureMember>
129+
<ogr:union0 fid="union0.19">
130+
<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:3857"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>1,14 1,16 4,16 4,15 2,15 2,14 1,14</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogr:geometryProperty>
131+
<ogr:id_a>A9</ogr:id_a>
132+
</ogr:union0>
133+
</gml:featureMember>
134+
<gml:featureMember>
135+
<ogr:union0 fid="union0.20">
136+
<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:3857"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>4,15 5,15 5,12 4,12 4,13 4,14 4,15</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogr:geometryProperty>
137+
<ogr:id_a>A10</ogr:id_a>
138+
</ogr:union0>
139+
</gml:featureMember>
140+
<gml:featureMember>
141+
<ogr:union0 fid="union0.21">
142+
<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:3857"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>6,11 10,11 10,12 7,12 7,15 6,15 6,11</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogr:geometryProperty>
143+
<ogr:id_a>A11</ogr:id_a>
144+
</ogr:union0>
145+
</gml:featureMember>
146+
<gml:featureMember>
147+
<ogr:union0 fid="union0.22">
148+
<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:3857"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>8,13 10,13 10,15 8,15 8,13</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogr:geometryProperty>
149+
<ogr:id_a>A12</ogr:id_a>
150+
</ogr:union0>
151+
</gml:featureMember>
152+
</ogr:FeatureCollection>
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+
<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="union0" type="ogr:union0_Type" substitutionGroup="gml:_Feature"/>
14+
<xs:complexType name="union0_Type">
15+
<xs:complexContent>
16+
<xs:extension base="gml:AbstractFeatureType">
17+
<xs:sequence>
18+
<xs:element name="geometryProperty" type="gml:MultiPolygonPropertyType" nillable="true" minOccurs="0" maxOccurs="1"/>
19+
<xs:element name="id_a" 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:sequence>
27+
</xs:extension>
28+
</xs:complexContent>
29+
</xs:complexType>
30+
</xs:schema>

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5330,6 +5330,21 @@ tests:
53305330
fields:
53315331
fid: skip
53325332

5333+
- algorithm: native:union
5334+
name: Test Union of single layer
5335+
params:
5336+
INPUT:
5337+
name: custom/overlay0.geojson
5338+
type: vector
5339+
results:
5340+
OUTPUT:
5341+
name: expected/union0.gml
5342+
type: vector
5343+
compare:
5344+
unordered: true
5345+
fields:
5346+
fid: skip
5347+
53335348
- algorithm: native:union
53345349
name: Test Union (basic)
53355350
params:

0 commit comments

Comments
 (0)