Skip to content

Commit c321700

Browse files
ghtmttnyalldawson
authored andcommittedNov 15, 2017
[processing] test for union algorithm
1 parent 2d188e9 commit c321700

File tree

5 files changed

+136
-0
lines changed

5 files changed

+136
-0
lines changed
 
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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/ for_union.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>18.6909193535413</gml:X><gml:Y>45.7778586469115</gml:Y></gml:coord>
10+
<gml:coord><gml:X>18.7047140186325</gml:X><gml:Y>45.8064427846727</gml:Y></gml:coord>
11+
</gml:Box>
12+
</gml:boundedBy>
13+
14+
<gml:featureMember>
15+
<ogr:for_union fid="1">
16+
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>18.6931079302144,45.8064427846727 18.6909193535413,45.7990812085903 18.6939700967826,45.7943061322126 18.7047140186325,45.7953009397913 18.6931079302144,45.8064427846727</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
17+
</ogr:for_union>
18+
</gml:featureMember>
19+
<gml:featureMember>
20+
<ogr:for_union fid="2">
21+
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>18.6989441346761,45.790923786445 18.695694429919,45.7842254154151 18.6982809296236,45.7800472235846 18.6998063012443,45.7778586469115 18.7027907239804,45.7864139920883 18.7047140186325,45.7884699277509 18.6989441346761,45.790923786445</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
22+
</ogr:for_union>
23+
</gml:featureMember>
24+
</ogr:FeatureCollection>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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="for_union" type="ogr:for_union_Type" substitutionGroup="gml:_Feature"/>
14+
<xs:complexType name="for_union_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:sequence>
20+
</xs:extension>
21+
</xs:complexContent>
22+
</xs:complexType>
23+
</xs:schema>
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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/ union.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>18.67319311115957</gml:X><gml:Y>45.7778586469115</gml:Y></gml:coord>
10+
<gml:coord><gml:X>18.7047140186325</gml:X><gml:Y>45.80786158698488</gml:Y></gml:coord>
11+
</gml:Box>
12+
</gml:boundedBy>
13+
14+
<gml:featureMember>
15+
<ogr:union fid="polygon_mask.0">
16+
<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:4326"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>18.6919679411186,45.8026082758958 18.6948297543933,45.8001757346123 18.694442232425,45.7962359279339 18.6931834255857,45.7955374436512 18.6909193535413,45.7990812085903 18.6919679411186,45.8026082758958</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogr:geometryProperty>
17+
</ogr:union>
18+
</gml:featureMember>
19+
<gml:featureMember>
20+
<ogr:union fid="polygon_mask.0">
21+
<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:4326"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>18.6744202640594,45.7984964727494 18.6832040953424,45.8078615869849 18.6896627948151,45.8045676502538 18.6919679411186,45.8026082758958 18.6909193535413,45.7990812085903 18.6931834255857,45.7955374436512 18.6838499652896,45.7903585114137 18.6759703519329,45.7902293374243 18.6731931111596,45.7899709894453 18.6744202640594,45.7984964727494</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogr:geometryProperty>
22+
</ogr:union>
23+
</gml:featureMember>
24+
<gml:featureMember>
25+
<ogr:union fid="polygon_mask.1">
26+
<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:4326"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>18.6977017543579,45.7883629617075 18.7009009318977,45.7856436607986 18.6997383659926,45.7811225711677 18.6979288821319,45.7806159156867 18.695694429919,45.7842254154151 18.6977017543579,45.7883629617075</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogr:geometryProperty>
27+
</ogr:union>
28+
</gml:featureMember>
29+
<gml:featureMember>
30+
<ogr:union fid="polygon_mask.1">
31+
<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:4326"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>18.6906961867308,45.7866124657195 18.694442232425,45.7911335553504 18.6977017543579,45.7883629617075 18.695694429919,45.7842254154151 18.6979288821319,45.7806159156867 18.6884356419153,45.777957808426 18.6804914415638,45.7798954182678 18.6800393326007,45.7833185289884 18.6906961867308,45.7866124657195</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogr:geometryProperty>
32+
</ogr:union>
33+
</gml:featureMember>
34+
<gml:featureMember>
35+
<ogr:union fid="union.4">
36+
<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:4326"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>18.6919679411186,45.8026082758958 18.6931079302144,45.8064427846727 18.7047140186325,45.7953009397913 18.6939700967826,45.7943061322126 18.6931834255857,45.7955374436512 18.694442232425,45.7962359279339 18.6948297543933,45.8001757346123 18.6919679411186,45.8026082758958</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogr:geometryProperty>
37+
<ogr:fid_2>1</ogr:fid_2>
38+
</ogr:union>
39+
</gml:featureMember>
40+
<gml:featureMember>
41+
<ogr:union fid="union.5">
42+
<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:4326"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>18.6977017543579,45.7883629617075 18.6989441346761,45.790923786445 18.7047140186325,45.7884699277509 18.7027907239804,45.7864139920883 18.6998063012443,45.7778586469115 18.6982809296236,45.7800472235846 18.6979288821319,45.7806159156867 18.6997383659926,45.7811225711677 18.7009009318977,45.7856436607986 18.6977017543579,45.7883629617075</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogr:geometryProperty>
43+
<ogr:fid_2>2</ogr:fid_2>
44+
</ogr:union>
45+
</gml:featureMember>
46+
</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="union" type="ogr:union_Type" substitutionGroup="gml:_Feature"/>
14+
<xs:complexType name="union_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="fid_2" 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: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4499,3 +4499,16 @@ tests:
44994499
__all__:
45004500
precision: 7
45014501

4502+
- algorithm: qgis:union
4503+
name: Union simple
4504+
params:
4505+
INPUT:
4506+
name: custom/polygon_mask.gml
4507+
type: vector
4508+
OVERLAY:
4509+
name: custom/for_union.gml
4510+
type: vector
4511+
results:
4512+
OUTPUT:
4513+
name: expected/union.gml
4514+
type: vector

0 commit comments

Comments
 (0)
Please sign in to comment.