Skip to content

Commit

Permalink
add tests for distance matrix algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy committed Oct 24, 2017
1 parent c64f03d commit 04a8418
Show file tree
Hide file tree
Showing 7 changed files with 1,166 additions and 0 deletions.
662 changes: 662 additions & 0 deletions python/plugins/processing/tests/testdata/expected/linear_matrix.gml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?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="linear_matrix" type="ogr:linear_matrix_Type" substitutionGroup="gml:_Feature"/>
<xs:complexType name="linear_matrix_Type">
<xs:complexContent>
<xs:extension base="gml:AbstractFeatureType">
<xs:sequence>
<xs:element name="geometryProperty" type="gml:MultiPointPropertyType" nillable="true" minOccurs="0" maxOccurs="1"/>
<xs:element name="InputID" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="255"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="TargetID" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="255"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Distance" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:decimal">
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>
149 changes: 149 additions & 0 deletions python/plugins/processing/tests/testdata/expected/standard_matrix.gml
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ogr.maptools.org/ standard_matrix.xsd"
xmlns:ogr="http://ogr.maptools.org/"
xmlns:gml="http://www.opengis.net/gml">
<gml:boundedBy>
<gml:Box>
<gml:coord><gml:X>0</gml:X><gml:Y>-5</gml:Y></gml:coord>
<gml:coord><gml:X>8</gml:X><gml:Y>3</gml:Y></gml:coord>
</gml:Box>
</gml:boundedBy>

<gml:featureMember>
<ogr:standard_matrix fid="standard_matrix.0">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>1,1</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:ID>points.0</ogr:ID>
<ogr:points.7>6.32455532033676</ogr:points.7>
<ogr:points.6>7.28010988928052</ogr:points.6>
<ogr:points.5>6.08276253029822</ogr:points.5>
<ogr:points.4>3</ogr:points.4>
<ogr:points.8>2.23606797749979</ogr:points.8>
<ogr:points.3>4.12310562561766</ogr:points.3>
<ogr:points.2>1.4142135623731</ogr:points.2>
<ogr:points.1>2.82842712474619</ogr:points.1>
<ogr:points.0>0</ogr:points.0>
</ogr:standard_matrix>
</gml:featureMember>
<gml:featureMember>
<ogr:standard_matrix fid="standard_matrix.1">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>3,3</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:ID>points.1</ogr:ID>
<ogr:points.7>5.65685424949238</ogr:points.7>
<ogr:points.6>6.40312423743285</ogr:points.6>
<ogr:points.5>8.54400374531753</ogr:points.5>
<ogr:points.4>2.23606797749979</ogr:points.4>
<ogr:points.8>5</ogr:points.8>
<ogr:points.3>2.23606797749979</ogr:points.3>
<ogr:points.2>1.4142135623731</ogr:points.2>
<ogr:points.1>0</ogr:points.1>
<ogr:points.0>2.82842712474619</ogr:points.0>
</ogr:standard_matrix>
</gml:featureMember>
<gml:featureMember>
<ogr:standard_matrix fid="standard_matrix.2">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>2,2</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:ID>points.2</ogr:ID>
<ogr:points.7>5.8309518948453</ogr:points.7>
<ogr:points.6>6.70820393249937</ogr:points.6>
<ogr:points.5>7.28010988928052</ogr:points.5>
<ogr:points.4>2.23606797749979</ogr:points.4>
<ogr:points.8>3.60555127546399</ogr:points.8>
<ogr:points.3>3</ogr:points.3>
<ogr:points.2>0</ogr:points.2>
<ogr:points.1>1.4142135623731</ogr:points.1>
<ogr:points.0>1.4142135623731</ogr:points.0>
</ogr:standard_matrix>
</gml:featureMember>
<gml:featureMember>
<ogr:standard_matrix fid="standard_matrix.3">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>5,2</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:ID>points.3</ogr:ID>
<ogr:points.7>3.60555127546399</ogr:points.7>
<ogr:points.6>4.24264068711928</ogr:points.6>
<ogr:points.5>8.60232526704263</ogr:points.5>
<ogr:points.4>1.4142135623731</ogr:points.4>
<ogr:points.8>5.8309518948453</ogr:points.8>
<ogr:points.3>0</ogr:points.3>
<ogr:points.2>3</ogr:points.2>
<ogr:points.1>2.23606797749979</ogr:points.1>
<ogr:points.0>4.12310562561766</ogr:points.0>
</ogr:standard_matrix>
</gml:featureMember>
<gml:featureMember>
<ogr:standard_matrix fid="standard_matrix.4">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>4,1</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:ID>points.4</ogr:ID>
<ogr:points.7>3.60555127546399</ogr:points.7>
<ogr:points.6>4.47213595499958</ogr:points.6>
<ogr:points.5>7.21110255092798</ogr:points.5>
<ogr:points.4>0</ogr:points.4>
<ogr:points.8>4.47213595499958</ogr:points.8>
<ogr:points.3>1.4142135623731</ogr:points.3>
<ogr:points.2>2.23606797749979</ogr:points.2>
<ogr:points.1>2.23606797749979</ogr:points.1>
<ogr:points.0>3</ogr:points.0>
</ogr:standard_matrix>
</gml:featureMember>
<gml:featureMember>
<ogr:standard_matrix fid="standard_matrix.5">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>0,-5</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:ID>points.5</ogr:ID>
<ogr:points.7>8.06225774829855</ogr:points.7>
<ogr:points.6>8.94427190999916</ogr:points.6>
<ogr:points.5>0</ogr:points.5>
<ogr:points.4>7.21110255092798</ogr:points.4>
<ogr:points.8>4</ogr:points.8>
<ogr:points.3>8.60232526704263</ogr:points.3>
<ogr:points.2>7.28010988928052</ogr:points.2>
<ogr:points.1>8.54400374531753</ogr:points.1>
<ogr:points.0>6.08276253029822</ogr:points.0>
</ogr:standard_matrix>
</gml:featureMember>
<gml:featureMember>
<ogr:standard_matrix fid="standard_matrix.6">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>8,-1</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:ID>points.6</ogr:ID>
<ogr:points.7>1</ogr:points.7>
<ogr:points.6>0</ogr:points.6>
<ogr:points.5>8.94427190999916</ogr:points.5>
<ogr:points.4>4.47213595499958</ogr:points.4>
<ogr:points.8>8</ogr:points.8>
<ogr:points.3>4.24264068711928</ogr:points.3>
<ogr:points.2>6.70820393249937</ogr:points.2>
<ogr:points.1>6.40312423743285</ogr:points.1>
<ogr:points.0>7.28010988928052</ogr:points.0>
</ogr:standard_matrix>
</gml:featureMember>
<gml:featureMember>
<ogr:standard_matrix fid="standard_matrix.7">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>7,-1</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:ID>points.7</ogr:ID>
<ogr:points.7>0</ogr:points.7>
<ogr:points.6>1</ogr:points.6>
<ogr:points.5>8.06225774829855</ogr:points.5>
<ogr:points.4>3.60555127546399</ogr:points.4>
<ogr:points.8>7</ogr:points.8>
<ogr:points.3>3.60555127546399</ogr:points.3>
<ogr:points.2>5.8309518948453</ogr:points.2>
<ogr:points.1>5.65685424949238</ogr:points.1>
<ogr:points.0>6.32455532033676</ogr:points.0>
</ogr:standard_matrix>
</gml:featureMember>
<gml:featureMember>
<ogr:standard_matrix fid="standard_matrix.8">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>0,-1</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:ID>points.8</ogr:ID>
<ogr:points.7>7</ogr:points.7>
<ogr:points.6>8</ogr:points.6>
<ogr:points.5>4</ogr:points.5>
<ogr:points.4>4.47213595499958</ogr:points.4>
<ogr:points.8>0</ogr:points.8>
<ogr:points.3>5.8309518948453</ogr:points.3>
<ogr:points.2>3.60555127546399</ogr:points.2>
<ogr:points.1>5</ogr:points.1>
<ogr:points.0>2.23606797749979</ogr:points.0>
</ogr:standard_matrix>
</gml:featureMember>
</ogr:FeatureCollection>
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<?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="standard_matrix" type="ogr:standard_matrix_Type" substitutionGroup="gml:_Feature"/>
<xs:complexType name="standard_matrix_Type">
<xs:complexContent>
<xs:extension base="gml:AbstractFeatureType">
<xs:sequence>
<xs:element name="geometryProperty" type="gml:PointPropertyType" nillable="true" minOccurs="0" maxOccurs="1"/>
<xs:element name="ID" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="255"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="points.7" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:decimal">
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="points.6" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:decimal">
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="points.5" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:decimal">
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="points.4" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:decimal">
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="points.8" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:decimal">
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="points.3" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:decimal">
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="points.2" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:decimal">
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="points.1" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:decimal">
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="points.0" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:decimal">
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>
104 changes: 104 additions & 0 deletions python/plugins/processing/tests/testdata/expected/summary_matrix.gml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ogr.maptools.org/ summary_matrix.xsd"
xmlns:ogr="http://ogr.maptools.org/"
xmlns:gml="http://www.opengis.net/gml">
<gml:boundedBy>
<gml:Box>
<gml:coord><gml:X>0</gml:X><gml:Y>-5</gml:Y></gml:coord>
<gml:coord><gml:X>8</gml:X><gml:Y>3</gml:Y></gml:coord>
</gml:Box>
</gml:boundedBy>

<gml:featureMember>
<ogr:summary_matrix fid="summary_matrix.0">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>1,1</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:InputID>points.0</ogr:InputID>
<ogr:MEAN>3.69880467001691</ogr:MEAN>
<ogr:STDDEV>2.30626191337</ogr:STDDEV>
<ogr:MIN>0</ogr:MIN>
<ogr:MAX>7.28010988928052</ogr:MAX>
</ogr:summary_matrix>
</gml:featureMember>
<gml:featureMember>
<ogr:summary_matrix fid="summary_matrix.1">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>3,3</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:InputID>points.1</ogr:InputID>
<ogr:MEAN>3.81319543048463</ogr:MEAN>
<ogr:STDDEV>2.58491060409319</ogr:STDDEV>
<ogr:MIN>0</ogr:MIN>
<ogr:MAX>8.54400374531753</ogr:MAX>
</ogr:summary_matrix>
</gml:featureMember>
<gml:featureMember>
<ogr:summary_matrix fid="summary_matrix.2">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>2,2</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:InputID>points.2</ogr:InputID>
<ogr:MEAN>3.49881245492613</ogr:MEAN>
<ogr:STDDEV>2.42268910848357</ogr:STDDEV>
<ogr:MIN>0</ogr:MIN>
<ogr:MAX>7.28010988928052</ogr:MAX>
</ogr:summary_matrix>
</gml:featureMember>
<gml:featureMember>
<ogr:summary_matrix fid="summary_matrix.3">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>5,2</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:InputID>points.3</ogr:InputID>
<ogr:MEAN>3.67276180999575</ogr:MEAN>
<ogr:STDDEV>2.37106132315211</ogr:STDDEV>
<ogr:MIN>0</ogr:MIN>
<ogr:MAX>8.60232526704263</ogr:MAX>
</ogr:summary_matrix>
</gml:featureMember>
<gml:featureMember>
<ogr:summary_matrix fid="summary_matrix.4">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>4,1</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:InputID>points.4</ogr:InputID>
<ogr:MEAN>3.18303058375153</ogr:MEAN>
<ogr:STDDEV>1.96680357506854</ogr:STDDEV>
<ogr:MIN>0</ogr:MIN>
<ogr:MAX>7.21110255092798</ogr:MAX>
</ogr:summary_matrix>
</gml:featureMember>
<gml:featureMember>
<ogr:summary_matrix fid="summary_matrix.5">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>0,-5</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:InputID>points.5</ogr:InputID>
<ogr:MEAN>6.52520373790717</ogr:MEAN>
<ogr:STDDEV>2.72428269069167</ogr:STDDEV>
<ogr:MIN>0</ogr:MIN>
<ogr:MAX>8.94427190999916</ogr:MAX>
</ogr:summary_matrix>
</gml:featureMember>
<gml:featureMember>
<ogr:summary_matrix fid="summary_matrix.6">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>8,-1</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:InputID>points.6</ogr:InputID>
<ogr:MEAN>5.22783184570342</ogr:MEAN>
<ogr:STDDEV>2.90646726642964</ogr:STDDEV>
<ogr:MIN>0</ogr:MIN>
<ogr:MAX>8.94427190999916</ogr:MAX>
</ogr:summary_matrix>
</gml:featureMember>
<gml:featureMember>
<ogr:summary_matrix fid="summary_matrix.7">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>7,-1</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:InputID>points.7</ogr:InputID>
<ogr:MEAN>4.565080195989</ogr:MEAN>
<ogr:STDDEV>2.56991969692314</ogr:STDDEV>
<ogr:MIN>0</ogr:MIN>
<ogr:MAX>8.06225774829855</ogr:MAX>
</ogr:summary_matrix>
</gml:featureMember>
<gml:featureMember>
<ogr:summary_matrix fid="summary_matrix.8">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>0,-1</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:InputID>points.8</ogr:InputID>
<ogr:MEAN>4.46052301142318</ogr:MEAN>
<ogr:STDDEV>2.28360363804128</ogr:STDDEV>
<ogr:MIN>0</ogr:MIN>
<ogr:MAX>8</ogr:MAX>
</ogr:summary_matrix>
</gml:featureMember>
</ogr:FeatureCollection>
Loading

0 comments on commit 04a8418

Please sign in to comment.