Skip to content

Commit 0930e18

Browse files
committed
Add tests for gridify
1 parent 591de92 commit 0930e18

File tree

5 files changed

+177
-0
lines changed

5 files changed

+177
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<GMLFeatureClassList>
2+
<GMLFeatureClass>
3+
<Name>gridify_lines</Name>
4+
<ElementPath>gridify_lines</ElementPath>
5+
<!--LINESTRING-->
6+
<GeometryType>2</GeometryType>
7+
<SRSName>EPSG:4326</SRSName>
8+
<DatasetSpecificInfo>
9+
<FeatureCount>7</FeatureCount>
10+
<ExtentXMin>2.00000</ExtentXMin>
11+
<ExtentXMax>12.00000</ExtentXMax>
12+
<ExtentYMin>-4.00000</ExtentYMin>
13+
<ExtentYMax>4.00000</ExtentYMax>
14+
</DatasetSpecificInfo>
15+
</GMLFeatureClass>
16+
</GMLFeatureClassList>
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=""
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>2</gml:X><gml:Y>-4</gml:Y></gml:coord>
10+
<gml:coord><gml:X>12</gml:X><gml:Y>4</gml:Y></gml:coord>
11+
</gml:Box>
12+
</gml:boundedBy>
13+
14+
<gml:featureMember>
15+
<ogr:gridify_lines fid="lines.0">
16+
<ogr:geometryProperty><gml:LineString srsName="EPSG:4326"><gml:coordinates>6,2 8,2 8,4 12,4</gml:coordinates></gml:LineString></ogr:geometryProperty>
17+
</ogr:gridify_lines>
18+
</gml:featureMember>
19+
<gml:featureMember>
20+
<ogr:gridify_lines fid="lines.1">
21+
</ogr:gridify_lines>
22+
</gml:featureMember>
23+
<gml:featureMember>
24+
<ogr:gridify_lines fid="lines.2">
25+
<ogr:geometryProperty><gml:LineString srsName="EPSG:4326"><gml:coordinates>2,0 2,2 4,2 4,4</gml:coordinates></gml:LineString></ogr:geometryProperty>
26+
</ogr:gridify_lines>
27+
</gml:featureMember>
28+
<gml:featureMember>
29+
<ogr:gridify_lines fid="lines.3">
30+
</ogr:gridify_lines>
31+
</gml:featureMember>
32+
<gml:featureMember>
33+
<ogr:gridify_lines fid="lines.4">
34+
<ogr:geometryProperty><gml:LineString srsName="EPSG:4326"><gml:coordinates>8,-4 10,-4</gml:coordinates></gml:LineString></ogr:geometryProperty>
35+
</ogr:gridify_lines>
36+
</gml:featureMember>
37+
<gml:featureMember>
38+
<ogr:gridify_lines fid="lines.5">
39+
<ogr:geometryProperty><gml:LineString srsName="EPSG:4326"><gml:coordinates>6,-4 10,0</gml:coordinates></gml:LineString></ogr:geometryProperty>
40+
</ogr:gridify_lines>
41+
</gml:featureMember>
42+
<gml:featureMember>
43+
<ogr:gridify_lines fid="lines.6">
44+
</ogr:gridify_lines>
45+
</gml:featureMember>
46+
</ogr:FeatureCollection>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<GMLFeatureClassList>
2+
<GMLFeatureClass>
3+
<Name>gridify_polys</Name>
4+
<ElementPath>gridify_polys</ElementPath>
5+
<!--POLYGON-->
6+
<GeometryType>3</GeometryType>
7+
<SRSName>EPSG:4326</SRSName>
8+
<DatasetSpecificInfo>
9+
<FeatureCount>6</FeatureCount>
10+
<ExtentXMin>0.00000</ExtentXMin>
11+
<ExtentXMax>10.00000</ExtentXMax>
12+
<ExtentYMin>-4.00000</ExtentYMin>
13+
<ExtentYMax>6.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>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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>-4</gml:Y></gml:coord>
10+
<gml:coord><gml:X>10</gml:X><gml:Y>6</gml:Y></gml:coord>
11+
</gml:Box>
12+
</gml:boundedBy>
13+
14+
<gml:featureMember>
15+
<ogr:gridify_polys fid="polys.0">
16+
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>0,0 0,4 4,4 4,2 2,2 2,0 0,0</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:gridify_polys>
21+
</gml:featureMember>
22+
<gml:featureMember>
23+
<ogr:gridify_polys fid="polys.1">
24+
<ogr:name>Aaaaa</ogr:name>
25+
<ogr:intval>-33</ogr:intval>
26+
<ogr:floatval>0</ogr:floatval>
27+
</ogr:gridify_polys>
28+
</gml:featureMember>
29+
<gml:featureMember>
30+
<ogr:gridify_polys fid="polys.2">
31+
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>2,4 2,6 4,6 4,4 2,4</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
32+
<ogr:name>bbaaa</ogr:name>
33+
<ogr:floatval>0.123</ogr:floatval>
34+
</ogr:gridify_polys>
35+
</gml:featureMember>
36+
<gml:featureMember>
37+
<ogr:gridify_polys fid="polys.3">
38+
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>6,0 10,0 10,-4 6,-4 6,0</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
39+
<ogr:name>ASDF</ogr:name>
40+
<ogr:intval>0</ogr:intval>
41+
</ogr:gridify_polys>
42+
</gml:featureMember>
43+
<gml:featureMember>
44+
<ogr:gridify_polys fid="polys.4">
45+
<ogr:intval>120</ogr:intval>
46+
<ogr:floatval>-100291.43213</ogr:floatval>
47+
</ogr:gridify_polys>
48+
</gml:featureMember>
49+
<gml:featureMember>
50+
<ogr:gridify_polys fid="polys.5">
51+
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>4,2 6,0 6,-4 2,0 2,2 4,2</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
52+
<ogr:name>elim</ogr:name>
53+
<ogr:intval>2</ogr:intval>
54+
<ogr:floatval>3.33</ogr:floatval>
55+
</ogr:gridify_polys>
56+
</gml:featureMember>
57+
</ogr:FeatureCollection>

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

+26
Original file line numberDiff line numberDiff line change
@@ -2158,6 +2158,32 @@ tests:
21582158
name: expected/lines_to_polygon.gml
21592159
type: vector
21602160

2161+
- algorithm: qgis:snappointstogrid
2162+
name: Gridify polys
2163+
params:
2164+
INPUT:
2165+
name: polys.gml
2166+
type: vector
2167+
HSPACING: 2
2168+
VSPACING: 2
2169+
results:
2170+
OUTPUT:
2171+
name: expected/gridify_polys.gml
2172+
type: vector
2173+
2174+
- algorithm: qgis:snappointstogrid
2175+
name: Gridify lines
2176+
params:
2177+
INPUT:
2178+
name: lines.gml
2179+
type: vector
2180+
HSPACING: 2
2181+
VSPACING: 2
2182+
results:
2183+
OUTPUT:
2184+
name: expected/gridify_lines.gml
2185+
type: vector
2186+
21612187
# - algorithm: qgis:joinattributestable
21622188
# name: join the attribute table by common field
21632189
# params:

0 commit comments

Comments
 (0)