Skip to content

Commit 0da3069

Browse files
committed
[processing] Add unit tests for reclassify using nulls
1 parent 7c1dcfa commit 0da3069

3 files changed

Lines changed: 112 additions & 0 deletions

File tree

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+
<ogr:FeatureCollection
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://ogr.maptools.org/ reclassify_layer_nulls.xsd"
5+
xmlns:ogr="http://ogr.maptools.org/"
6+
xmlns:gml="http://www.opengis.net/gml">
7+
<gml:boundedBy><gml:null>missing</gml:null></gml:boundedBy>
8+
9+
<gml:featureMember>
10+
<ogr:reclassify_layer_nulls fid="1">
11+
<ogr:min xsi:nil="true"/>
12+
<ogr:max>850</ogr:max>
13+
<ogr:value>3</ogr:value>
14+
</ogr:reclassify_layer_nulls>
15+
</gml:featureMember>
16+
<gml:featureMember>
17+
<ogr:reclassify_layer_nulls fid="2">
18+
<ogr:min>850</ogr:min>
19+
<ogr:max xsi:nil="true"/>
20+
<ogr:value>4</ogr:value>
21+
</ogr:reclassify_layer_nulls>
22+
</gml:featureMember>
23+
</ogr:FeatureCollection>
Lines changed: 43 additions & 0 deletions
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="reclassify_layer_nulls" type="ogr:reclassify_layer_nulls_Type" substitutionGroup="gml:_Feature"/>
14+
<xs:complexType name="reclassify_layer_nulls_Type">
15+
<xs:complexContent>
16+
<xs:extension base="gml:AbstractFeatureType">
17+
<xs:sequence>
18+
<xs:element name="min" nillable="true" minOccurs="0" maxOccurs="1">
19+
<xs:simpleType>
20+
<xs:restriction base="xs:integer">
21+
<xs:totalDigits value="10"/>
22+
</xs:restriction>
23+
</xs:simpleType>
24+
</xs:element>
25+
<xs:element name="max" nillable="true" minOccurs="0" maxOccurs="1">
26+
<xs:simpleType>
27+
<xs:restriction base="xs:integer">
28+
<xs:totalDigits value="10"/>
29+
</xs:restriction>
30+
</xs:simpleType>
31+
</xs:element>
32+
<xs:element name="value" nillable="true" minOccurs="0" maxOccurs="1">
33+
<xs:simpleType>
34+
<xs:restriction base="xs:integer">
35+
<xs:totalDigits value="10"/>
36+
</xs:restriction>
37+
</xs:simpleType>
38+
</xs:element>
39+
</xs:sequence>
40+
</xs:extension>
41+
</xs:complexContent>
42+
</xs:complexType>
43+
</xs:schema>

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

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5581,6 +5581,29 @@ tests:
55815581
hash: cea558f7e99a0564fef92a96cd8d6b59707d019f1751cb600ab00850
55825582
type: rasterhash
55835583

5584+
- algorithm: native:reclassifybytable
5585+
name: Reclassify by table infinite ranges
5586+
params:
5587+
DATA_TYPE: 5
5588+
INPUT_RASTER:
5589+
name: raster.tif
5590+
type: raster
5591+
NODATA_FOR_MISSING: false
5592+
NO_DATA: -9999.0
5593+
RANGE_BOUNDARIES: 0
5594+
RASTER_BAND: 1
5595+
TABLE:
5596+
- ''
5597+
- 850
5598+
- 3
5599+
- 850
5600+
- ''
5601+
- 4
5602+
results:
5603+
OUTPUT:
5604+
hash: c29d14f71e8686f7445d53be646fce84702644f159fd0164ac38e861
5605+
type: rasterhash
5606+
55845607
- algorithm: native:reclassifybylayer
55855608
name: Reclassify by layer
55865609
params:
@@ -5602,5 +5625,28 @@ tests:
56025625
hash: c29d14f71e8686f7445d53be646fce84702644f159fd0164ac38e861
56035626
type: rasterhash
56045627

5628+
- algorithm: native:reclassifybylayer
5629+
name: Reclassify by layer with nulls
5630+
params:
5631+
DATA_TYPE: 5
5632+
INPUT_RASTER:
5633+
name: raster.tif
5634+
type: raster
5635+
INPUT_TABLE:
5636+
name: custom/reclassify_layer_nulls.gml
5637+
type: vector
5638+
MAX_FIELD: max
5639+
MIN_FIELD: min
5640+
NODATA_FOR_MISSING: false
5641+
NO_DATA: -9999.0
5642+
RANGE_BOUNDARIES: 0
5643+
RASTER_BAND: 1
5644+
VALUE_FIELD: value
5645+
results:
5646+
OUTPUT:
5647+
hash: c29d14f71e8686f7445d53be646fce84702644f159fd0164ac38e861
5648+
type: rasterhash
5649+
5650+
56055651

56065652
# See ../README.md for a description of the file format

0 commit comments

Comments
 (0)