Navigation Menu

Skip to content

Commit

Permalink
tests for r.path algorithms
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy authored and nyalldawson committed Sep 7, 2021
1 parent e3a159f commit 3a082f5
Show file tree
Hide file tree
Showing 7 changed files with 166 additions and 0 deletions.
6 changes: 6 additions & 0 deletions python/plugins/grassprovider/tests/testdata/directions.tfw
@@ -0,0 +1,6 @@
0.0001000000
0.0000000000
0.0000000000
-0.0001000000
18.6663479442
45.8116514375
Binary file not shown.
20 changes: 20 additions & 0 deletions python/plugins/grassprovider/tests/testdata/expected/r_path.gml
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ogr.maptools.org/ r_path.xsd"
xmlns:ogr="http://ogr.maptools.org/"
xmlns:gml="http://www.opengis.net/gml">
<gml:boundedBy>
<gml:Box>
<gml:coord><gml:X>18.67324794416666</gml:X><gml:Y>45.7772514375</gml:Y></gml:coord>
<gml:coord><gml:X>18.68364794416667</gml:X><gml:Y>45.8055514375</gml:Y></gml:coord>
</gml:Box>
</gml:boundedBy>

<gml:featureMember>
<ogr:r_path fid="1">
<ogr:geometryProperty><gml:LineString srsName="EPSG:4326"><gml:coordinates>18.6836479441667,45.7772514375 18.6835479441667,45.7774514375 18.6834479441667,45.7776514375 18.6833479441667,45.7778514375 18.6832479441667,45.7780514375 18.6831479441667,45.7782514375 18.6830479441667,45.7784514375 18.6830479441667,45.7785514375 18.6829479441667,45.7787514375 18.6828479441667,45.7789514375 18.6827479441667,45.7791514375 18.6826479441667,45.7793514375 18.6825479441667,45.7795514375 18.6824479441667,45.7797514375 18.6823479441667,45.7799514375 18.6822479441667,45.7801514375 18.6821479441667,45.7803514375 18.6820479441667,45.7805514375 18.6819479441667,45.7807514375 18.6818479441667,45.7809514375 18.6817479441667,45.7811514375 18.6816479441667,45.7813514375 18.6815479441667,45.7815514375 18.6814479441667,45.7817514375 18.6813479441667,45.7819514375 18.6812479441667,45.7821514375 18.6811479441667,45.7823514375 18.6810479441667,45.7825514375 18.6809479441667,45.7827514375 18.6808479441667,45.7829514375 18.6807479441667,45.7831514375 18.6806479441667,45.7833514375 18.6805479441667,45.7835514375 18.6804479441667,45.7837514375 18.6803479441667,45.7839514375 18.6802479441667,45.7841514375 18.6801479441667,45.7843514375 18.6800479441667,45.7845514375 18.6799479441667,45.7847514375 18.6798479441667,45.7849514375 18.6797479441667,45.7851514375 18.6796479441667,45.7853514375 18.6795479441667,45.7855514375 18.6794479441667,45.7857514375 18.6793479441667,45.7859514375 18.6792479441667,45.7861514375 18.6791479441667,45.7863514375 18.6790479441667,45.7865514375 18.6789479441667,45.7867514375 18.6788479441667,45.7869514375 18.6787479441667,45.7871514375 18.6786479441667,45.7873514375 18.6785479441667,45.7875514375 18.6784479441667,45.7877514375 18.6783479441667,45.7878514375 18.6782479441667,45.7879514375 18.6781479441667,45.7880514375 18.6780479441667,45.7881514375 18.6779479441667,45.7882514375 18.6778479441667,45.7883514375 18.6777479441667,45.7884514375 18.6776479441667,45.7885514375 18.6775479441667,45.7886514375 18.6774479441667,45.7888514375 18.6773479441667,45.7890514375 18.6772479441667,45.7892514375 18.6771479441667,45.7894514375 18.6770479441667,45.7896514375 18.6769479441667,45.7898514375 18.6768479441667,45.7900514375 18.6767479441667,45.7902514375 18.6766479441667,45.7904514375 18.6765479441667,45.7906514375 18.6764479441667,45.7908514375 18.6763479441667,45.7910514375 18.6762479441667,45.7912514375 18.6761479441667,45.7914514375 18.6760479441667,45.7916514375 18.6759479441667,45.7918514375 18.6758479441667,45.7920514375 18.6757479441667,45.7922514375 18.6757479441667,45.7923514375 18.6757479441667,45.7924514375 18.6756479441667,45.7926514375 18.6755479441667,45.7928514375 18.6754479441667,45.7930514375 18.6753479441667,45.7932514375 18.6752479441667,45.7934514375 18.6751479441667,45.7936514375 18.6751479441667,45.7937514375 18.6751479441667,45.7938514375 18.6751479441667,45.7939514375 18.6751479441667,45.7940514375 18.6751479441667,45.7941514375 18.6751479441667,45.7942514375 18.6751479441667,45.7943514375 18.6751479441667,45.7944514375 18.6751479441667,45.7945514375 18.6751479441667,45.7946514375 18.6751479441667,45.7947514375 18.6751479441667,45.7948514375 18.6751479441667,45.7949514375 18.6751479441667,45.7950514375 18.6751479441667,45.7951514375 18.6751479441667,45.7952514375 18.6751479441667,45.7953514375 18.6751479441667,45.7954514375 18.6751479441667,45.7955514375 18.6751479441667,45.7956514375 18.6751479441667,45.7957514375 18.6751479441667,45.7958514375 18.6751479441667,45.7959514375 18.6751479441667,45.7960514375 18.6751479441667,45.7961514375 18.6751479441667,45.7962514375 18.6751479441667,45.7963514375 18.6751479441667,45.7964514375 18.6751479441667,45.7965514375 18.6751479441667,45.7966514375 18.6751479441667,45.7967514375 18.6751479441667,45.7968514375 18.6751479441667,45.7969514375 18.6751479441667,45.7970514375 18.6751479441667,45.7971514375 18.6751479441667,45.7972514375 18.6751479441667,45.7973514375 18.6751479441667,45.7974514375 18.6751479441667,45.7975514375 18.6751479441667,45.7976514375 18.6751479441667,45.7977514375 18.6751479441667,45.7978514375 18.6751479441667,45.7979514375 18.6751479441667,45.7980514375 18.6751479441667,45.7981514375 18.6751479441667,45.7982514375 18.6751479441667,45.7983514375 18.6751479441667,45.7984514375 18.6751479441667,45.7985514375 18.6751479441667,45.7986514375 18.6751479441667,45.7987514375 18.6751479441667,45.7988514375 18.6751479441667,45.7989514375 18.6751479441667,45.7990514375 18.6751479441667,45.7991514375 18.6751479441667,45.7992514375 18.6751479441667,45.7993514375 18.6751479441667,45.7994514375 18.6751479441667,45.7995514375 18.6751479441667,45.7996514375 18.6751479441667,45.7997514375 18.6751479441667,45.7998514375 18.6751479441667,45.7999514375 18.6751479441667,45.8000514375 18.6751479441667,45.8001514375 18.6751479441667,45.8002514375 18.6751479441667,45.8003514375 18.6751479441667,45.8004514375 18.6751479441667,45.8005514375 18.6751479441667,45.8006514375 18.6751479441667,45.8007514375 18.6751479441667,45.8008514375 18.6751479441667,45.8009514375 18.6751479441667,45.8010514375 18.6751479441667,45.8011514375 18.6751479441667,45.8012514375 18.6751479441667,45.8013514375 18.6751479441667,45.8014514375 18.6751479441667,45.8015514375 18.6751479441667,45.8016514375 18.6751479441667,45.8017514375 18.6750479441667,45.8019514375 18.6749479441667,45.8021514375 18.6748479441667,45.8023514375 18.6747479441667,45.8025514375 18.6746479441667,45.8027514375 18.6745479441667,45.8029514375 18.6744479441667,45.8031514375 18.6743479441667,45.8033514375 18.6742479441667,45.8035514375 18.6741479441667,45.8037514375 18.6740479441667,45.8039514375 18.6739479441667,45.8041514375 18.6738479441667,45.8043514375 18.6737479441667,45.8045514375 18.6736479441667,45.8047514375 18.6735479441667,45.8049514375 18.6734479441667,45.8051514375 18.6733479441667,45.8053514375 18.6732479441667,45.8055514375</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:cat>1</ogr:cat>
</ogr:r_path>
</gml:featureMember>
</ogr:FeatureCollection>
30 changes: 30 additions & 0 deletions python/plugins/grassprovider/tests/testdata/expected/r_path.xsd
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<xs:import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengis.net/gml/2.1.2/feature.xsd"/>
<xs:element name="FeatureCollection" type="ogr:FeatureCollectionType" substitutionGroup="gml:_FeatureCollection"/>
<xs:complexType name="FeatureCollectionType">
<xs:complexContent>
<xs:extension base="gml:AbstractFeatureCollectionType">
<xs:attribute name="lockId" type="xs:string" use="optional"/>
<xs:attribute name="scope" type="xs:string" use="optional"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="r_path" type="ogr:r_path_Type" substitutionGroup="gml:_Feature"/>
<xs:complexType name="r_path_Type">
<xs:complexContent>
<xs:extension base="gml:AbstractFeatureType">
<xs:sequence>
<xs:element name="geometryProperty" type="gml:LineStringPropertyType" nillable="true" minOccurs="0" maxOccurs="1"/>
<xs:element name="cat" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:totalDigits value="10"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>
Expand Up @@ -846,3 +846,71 @@ tests:
output:
hash: 7e78e8b556c9a39e07b2bf8edbd45c17fbd1897de974c52bc97009a8
type: rasterhash

- algorithm: grass7:r.path
name: GRASS7 r.path
params:
-a: false
-c: false
-n: false
GRASS_MIN_AREA_PARAMETER: 0.0001
GRASS_OUTPUT_TYPE_PARAMETER: 0
GRASS_RASTER_FORMAT_META: ''
GRASS_RASTER_FORMAT_OPT: ''
GRASS_REGION_CELLSIZE_PARAMETER: 0.0
GRASS_SNAP_TOLERANCE_PARAMETER: -1.0
GRASS_VECTOR_DSCO: ''
GRASS_VECTOR_EXPORT_NOCAT: false
GRASS_VECTOR_LCO: ''
format: 0
input:
name: directions.tif
type: raster
start_points:
name: start_point.gml|layername=start_point
type: vector
results:
raster_path:
hash: 6c7bd077cb4dd98eb4c7c7d27d8ac396bbb496af9f3e27c769046f0b
type: rasterhash
vector_path:
name: expected/r_path.gml
type: vector
compare:
fields:
fid: skip
geometry:
precision: 7
ignore_crs_check: true

- algorithm: grass7:r.path.coordinate.txt
name: GRASS7 r.path (using point input)
params:
-a: false
-c: false
-n: false
GRASS_OUTPUT_TYPE_PARAMETER: 0
GRASS_RASTER_FORMAT_META: ''
GRASS_RASTER_FORMAT_OPT: ''
GRASS_REGION_CELLSIZE_PARAMETER: 0.0
GRASS_VECTOR_DSCO: ''
GRASS_VECTOR_EXPORT_NOCAT: false
GRASS_VECTOR_LCO: ''
format: 0
input:
name: directions.tif
type: raster
start_coordinates: 18.6836176953515,45.7772484991114 [EPSG:4326]
results:
raster_path:
hash: 6c7bd077cb4dd98eb4c7c7d27d8ac396bbb496af9f3e27c769046f0b
type: rasterhash
vector_path:
name: expected/r_path.gml
type: vector
compare:
fields:
fid: skip
geometry:
precision: 7
ignore_crs_check: true
19 changes: 19 additions & 0 deletions python/plugins/grassprovider/tests/testdata/start_point.gml
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ogr.maptools.org/ start_point.xsd"
xmlns:ogr="http://ogr.maptools.org/"
xmlns:gml="http://www.opengis.net/gml">
<gml:boundedBy>
<gml:Box>
<gml:coord><gml:X>18.6836176953515</gml:X><gml:Y>45.77724849911137</gml:Y></gml:coord>
<gml:coord><gml:X>18.6836176953515</gml:X><gml:Y>45.77724849911137</gml:Y></gml:coord>
</gml:Box>
</gml:boundedBy>

<gml:featureMember>
<ogr:start_point fid="start_point.0">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>18.6836176953515,45.7772484991114</gml:coordinates></gml:Point></ogr:geometryProperty>
</ogr:start_point>
</gml:featureMember>
</ogr:FeatureCollection>
23 changes: 23 additions & 0 deletions python/plugins/grassprovider/tests/testdata/start_point.xsd
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<xs:import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengis.net/gml/2.1.2/feature.xsd"/>
<xs:element name="FeatureCollection" type="ogr:FeatureCollectionType" substitutionGroup="gml:_FeatureCollection"/>
<xs:complexType name="FeatureCollectionType">
<xs:complexContent>
<xs:extension base="gml:AbstractFeatureCollectionType">
<xs:attribute name="lockId" type="xs:string" use="optional"/>
<xs:attribute name="scope" type="xs:string" use="optional"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="start_point" type="ogr:start_point_Type" substitutionGroup="gml:_Feature"/>
<xs:complexType name="start_point_Type">
<xs:complexContent>
<xs:extension base="gml:AbstractFeatureType">
<xs:sequence>
<xs:element name="geometryProperty" type="gml:PointPropertyType" nillable="true" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>

0 comments on commit 3a082f5

Please sign in to comment.