Skip to content

Commit

Permalink
Convex Hull processing tests (#3876)
Browse files Browse the repository at this point in the history
Add two tests for convex hull
  • Loading branch information
ghtmtt authored and m-kuhn committed Dec 19, 2016
1 parent 4ecad0a commit 2abeea1
Show file tree
Hide file tree
Showing 12 changed files with 521 additions and 0 deletions.
@@ -0,0 +1,20 @@
<GMLFeatureClassList>
<GMLFeatureClass>
<Name>count_unique_points</Name>
<ElementPath>count_unique_points</ElementPath>
<GeometryType>1</GeometryType>
<SRSName>EPSG:4326</SRSName>
<DatasetSpecificInfo>
<FeatureCount>26</FeatureCount>
<ExtentXMin>-0.18351</ExtentXMin>
<ExtentXMax>9.58625</ExtentXMax>
<ExtentYMin>-2.40588</ExtentYMin>
<ExtentYMax>5.73133</ExtentYMax>
</DatasetSpecificInfo>
<PropertyDefn>
<Name>unique</Name>
<ElementPath>unique</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
</GMLFeatureClass>
</GMLFeatureClassList>
@@ -0,0 +1,169 @@
<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=""
xmlns:ogr="http://ogr.maptools.org/"
xmlns:gml="http://www.opengis.net/gml">
<gml:boundedBy>
<gml:Box>
<gml:coord><gml:X>-0.1835059209628658</gml:X><gml:Y>-2.405884426380911</gml:Y></gml:coord>
<gml:coord><gml:X>9.586251045346421</gml:X><gml:Y>5.731328294905413</gml:Y></gml:coord>
</gml:Box>
</gml:boundedBy>

<gml:featureMember>
<ogr:count_unique_points fid="count_unique_points.0">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>-0.183505920962866,2.287680278060103</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:unique>10</ogr:unique>
</ogr:count_unique_points>
</gml:featureMember>
<gml:featureMember>
<ogr:count_unique_points fid="count_unique_points.1">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>1.372512812574644,1.496916659377106</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:unique>10</ogr:unique>
</ogr:count_unique_points>
</gml:featureMember>
<gml:featureMember>
<ogr:count_unique_points fid="count_unique_points.2">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>0.607257697720131,-0.084610577988888</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:unique>5</ogr:unique>
</ogr:count_unique_points>
</gml:featureMember>
<gml:featureMember>
<ogr:count_unique_points fid="count_unique_points.3">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>0.071579117321972,0.629627529208658</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:unique>10</ogr:unique>
</ogr:count_unique_points>
</gml:featureMember>
<gml:featureMember>
<ogr:count_unique_points fid="count_unique_points.4">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>2.41836146954248,2.542765316344942</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:unique>6</ogr:unique>
</ogr:count_unique_points>
</gml:featureMember>
<gml:featureMember>
<ogr:count_unique_points fid="count_unique_points.5">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>2.545903988684898,3.639630980969744</gml:coordinates></gml:Point></ogr:geometryProperty>
</ogr:count_unique_points>
</gml:featureMember>
<gml:featureMember>
<ogr:count_unique_points fid="count_unique_points.6">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>2.290818950400061,5.654802783419962</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:unique>2</ogr:unique>
</ogr:count_unique_points>
</gml:featureMember>
<gml:featureMember>
<ogr:count_unique_points fid="count_unique_points.7">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>2.698955011655801,5.731328294905413</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:unique>2</ogr:unique>
</ogr:count_unique_points>
</gml:featureMember>
<gml:featureMember>
<ogr:count_unique_points fid="count_unique_points.8">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>2.520395484856414,5.246666722164222</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:unique>1</ogr:unique>
</ogr:count_unique_points>
</gml:featureMember>
<gml:featureMember>
<ogr:count_unique_points fid="count_unique_points.9">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>4.561075791135116,4.277343576681838</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:unique>1</ogr:unique>
</ogr:count_unique_points>
</gml:featureMember>
<gml:featureMember>
<ogr:count_unique_points fid="count_unique_points.10">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>4.943703348562373,4.481411607309709</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:unique>2</ogr:unique>
</ogr:count_unique_points>
</gml:featureMember>
<gml:featureMember>
<ogr:count_unique_points fid="count_unique_points.11">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>2.928531546112155,1.190814613435302</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:unique>5</ogr:unique>
</ogr:count_unique_points>
</gml:featureMember>
<gml:featureMember>
<ogr:count_unique_points fid="count_unique_points.12">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>4.050905714565441,0.910221071321979</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:unique>5</ogr:unique>
</ogr:count_unique_points>
</gml:featureMember>
<gml:featureMember>
<ogr:count_unique_points fid="count_unique_points.13">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>4.841669333248438,0.195982964124434</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:unique>5</ogr:unique>
</ogr:count_unique_points>
</gml:featureMember>
<gml:featureMember>
<ogr:count_unique_points fid="count_unique_points.14">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>4.892686340905406,-1.206984746442174</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:unique>3</ogr:unique>
</ogr:count_unique_points>
</gml:featureMember>
<gml:featureMember>
<ogr:count_unique_points fid="count_unique_points.15">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>3.821329180109087,-1.155967738785206</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:unique>5</ogr:unique>
</ogr:count_unique_points>
</gml:featureMember>
<gml:featureMember>
<ogr:count_unique_points fid="count_unique_points.16">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>3.821329180109087,-0.390712623930693</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:unique>2</ogr:unique>
</ogr:count_unique_points>
</gml:featureMember>
<gml:featureMember>
<ogr:count_unique_points fid="count_unique_points.17">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>3.260142095882444,0.042931941153531</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:unique>5</ogr:unique>
</ogr:count_unique_points>
</gml:featureMember>
<gml:featureMember>
<ogr:count_unique_points fid="count_unique_points.18">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>2.954040049940638,-0.77334018135795</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:unique>5</ogr:unique>
</ogr:count_unique_points>
</gml:featureMember>
<gml:featureMember>
<ogr:count_unique_points fid="count_unique_points.19">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>6.958875151012592,0.527593513894724</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:unique>1</ogr:unique>
</ogr:count_unique_points>
</gml:featureMember>
<gml:featureMember>
<ogr:count_unique_points fid="count_unique_points.20">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>8.030232311808911,0.527593513894724</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:unique>7</ogr:unique>
</ogr:count_unique_points>
</gml:featureMember>
<gml:featureMember>
<ogr:count_unique_points fid="count_unique_points.21">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>9.076080968776745,0.349033987095337</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:unique>6</ogr:unique>
</ogr:count_unique_points>
</gml:featureMember>
<gml:featureMember>
<ogr:count_unique_points fid="count_unique_points.22">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>9.586251045346421,-1.58961230386943</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:unique>5</ogr:unique>
</ogr:count_unique_points>
</gml:featureMember>
<gml:featureMember>
<ogr:count_unique_points fid="count_unique_points.23">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>8.336334357750715,-1.462069784727012</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:unique>4</ogr:unique>
</ogr:count_unique_points>
</gml:featureMember>
<gml:featureMember>
<ogr:count_unique_points fid="count_unique_points.24">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>8.23430034243678,-2.405884426380911</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:unique>3</ogr:unique>
</ogr:count_unique_points>
</gml:featureMember>
<gml:featureMember>
<ogr:count_unique_points fid="count_unique_points.25">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>6.831332631870172,-1.997748365125171</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:unique>2</ogr:unique>
</ogr:count_unique_points>
</gml:featureMember>
</ogr:FeatureCollection>
30 changes: 30 additions & 0 deletions python/plugins/processing/tests/testdata/custom/points_hull.gfs
@@ -0,0 +1,30 @@
<GMLFeatureClassList>
<GMLFeatureClass>
<Name>points_hull</Name>
<ElementPath>points_hull</ElementPath>
<GeometryType>1</GeometryType>
<SRSName>EPSG:4326</SRSName>
<DatasetSpecificInfo>
<FeatureCount>9</FeatureCount>
<ExtentXMin>0.00000</ExtentXMin>
<ExtentXMax>8.00000</ExtentXMax>
<ExtentYMin>-5.00000</ExtentYMin>
<ExtentYMax>3.00000</ExtentYMax>
</DatasetSpecificInfo>
<PropertyDefn>
<Name>id</Name>
<ElementPath>id</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
<PropertyDefn>
<Name>id2</Name>
<ElementPath>id2</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
<PropertyDefn>
<Name>hull</Name>
<ElementPath>hull</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
</GMLFeatureClass>
</GMLFeatureClassList>
86 changes: 86 additions & 0 deletions python/plugins/processing/tests/testdata/custom/points_hull.gml
@@ -0,0 +1,86 @@
<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=""
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:points_hull fid="points.0">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>1,1</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:id>1</ogr:id>
<ogr:id2>2</ogr:id2>
<ogr:hull>2</ogr:hull>
</ogr:points_hull>
</gml:featureMember>
<gml:featureMember>
<ogr:points_hull fid="points.1">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>3,3</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:id>2</ogr:id>
<ogr:id2>1</ogr:id2>
<ogr:hull>3</ogr:hull>
</ogr:points_hull>
</gml:featureMember>
<gml:featureMember>
<ogr:points_hull fid="points.2">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>2,2</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:id>3</ogr:id>
<ogr:id2>0</ogr:id2>
<ogr:hull>3</ogr:hull>
</ogr:points_hull>
</gml:featureMember>
<gml:featureMember>
<ogr:points_hull fid="points.3">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>5,2</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:id>4</ogr:id>
<ogr:id2>2</ogr:id2>
<ogr:hull>3</ogr:hull>
</ogr:points_hull>
</gml:featureMember>
<gml:featureMember>
<ogr:points_hull fid="points.4">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>4,1</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:id>5</ogr:id>
<ogr:id2>1</ogr:id2>
<ogr:hull>2</ogr:hull>
</ogr:points_hull>
</gml:featureMember>
<gml:featureMember>
<ogr:points_hull fid="points.5">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>0,-5</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:id>6</ogr:id>
<ogr:id2>0</ogr:id2>
<ogr:hull>1</ogr:hull>
</ogr:points_hull>
</gml:featureMember>
<gml:featureMember>
<ogr:points_hull fid="points.6">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>8,-1</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:id>7</ogr:id>
<ogr:id2>0</ogr:id2>
<ogr:hull>2</ogr:hull>
</ogr:points_hull>
</gml:featureMember>
<gml:featureMember>
<ogr:points_hull fid="points.7">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>7,-1</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:id>8</ogr:id>
<ogr:id2>0</ogr:id2>
<ogr:hull>1</ogr:hull>
</ogr:points_hull>
</gml:featureMember>
<gml:featureMember>
<ogr:points_hull fid="points.8">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>0,-1</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:id>9</ogr:id>
<ogr:id2>0</ogr:id2>
<ogr:hull>1</ogr:hull>
</ogr:points_hull>
</gml:featureMember>
</ogr:FeatureCollection>
@@ -0,0 +1,21 @@
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head><body>
<p>Analyzed layer: polys</p>
<p>Analyzed field: floatval</p>
<p>Count: 5</p>
<p>Unique values: 5</p>
<p>NULL (missing) values: 1</p>
<p>Minimum value: -100291.43213</p>
<p>Maximum value: 44.123456</p>
<p>Range: 100335.555586</p>
<p>Sum: -100243.855674</p>
<p>Mean value: -20048.7711348</p>
<p>Median value: 0.123</p>
<p>Standard deviation: 40121.333967334256</p>
<p>Coefficient of Variation: -2.001186691073198</p>
<p>Minority (rarest occurring value): -100291.43213</p>
<p>Majority (most frequently occurring value): -100291.43213</p>
<p>First quartile: 0.0</p>
<p>Third quartile: 3.33</p>
<p>Interquartile Range (IQR): 3.33</p>
</body></html>
@@ -0,0 +1,21 @@
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head><body>
<p>Analyzed layer: polys</p>
<p>Analyzed field: intval</p>
<p>Count: 5</p>
<p>Unique values: 5</p>
<p>NULL (missing) values: 1</p>
<p>Minimum value: -33.0</p>
<p>Maximum value: 120.0</p>
<p>Range: 153.0</p>
<p>Sum: 122.0</p>
<p>Mean value: 24.4</p>
<p>Median value: 2.0</p>
<p>Standard deviation: 52.163588833591575</p>
<p>Coefficient of Variation: 2.137852001376704</p>
<p>Minority (rarest occurring value): -33.0</p>
<p>Majority (most frequently occurring value): -33.0</p>
<p>First quartile: 0.0</p>
<p>Third quartile: 33.0</p>
<p>Interquartile Range (IQR): 33.0</p>
</body></html>
36 changes: 36 additions & 0 deletions python/plugins/processing/tests/testdata/expected/convex_hull.gfs
@@ -0,0 +1,36 @@
<GMLFeatureClassList>
<GMLFeatureClass>
<Name>convex_hull</Name>
<ElementPath>convex_hull</ElementPath>
<GeometryType>3</GeometryType>
<SRSName>EPSG:4326</SRSName>
<DatasetSpecificInfo>
<FeatureCount>1</FeatureCount>
<ExtentXMin>0.00000</ExtentXMin>
<ExtentXMax>8.00000</ExtentXMax>
<ExtentYMin>-5.00000</ExtentYMin>
<ExtentYMax>3.00000</ExtentYMax>
</DatasetSpecificInfo>
<PropertyDefn>
<Name>id</Name>
<ElementPath>id</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
<PropertyDefn>
<Name>value</Name>
<ElementPath>value</ElementPath>
<Type>String</Type>
<Width>3</Width>
</PropertyDefn>
<PropertyDefn>
<Name>area</Name>
<ElementPath>area</ElementPath>
<Type>Real</Type>
</PropertyDefn>
<PropertyDefn>
<Name>perim</Name>
<ElementPath>perim</ElementPath>
<Type>Real</Type>
</PropertyDefn>
</GMLFeatureClass>
</GMLFeatureClassList>

0 comments on commit 2abeea1

Please sign in to comment.