-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add unit test for processing polygonize algorithm
- Loading branch information
1 parent
14bd79f
commit 87f2fe5
Showing
6 changed files
with
146 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
python/plugins/processing/tests/testdata/custom/polygonize_lines.gfs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<GMLFeatureClassList> | ||
<GMLFeatureClass> | ||
<Name>polygonize_lines</Name> | ||
<ElementPath>polygonize_lines</ElementPath> | ||
<!--LINESTRING--> | ||
<GeometryType>2</GeometryType> | ||
<SRSName>EPSG:4326</SRSName> | ||
<DatasetSpecificInfo> | ||
<FeatureCount>6</FeatureCount> | ||
<ExtentXMin>-0.80000</ExtentXMin> | ||
<ExtentXMax>0.80000</ExtentXMax> | ||
<ExtentYMin>-0.40000</ExtentYMin> | ||
<ExtentYMax>0.80000</ExtentYMax> | ||
</DatasetSpecificInfo> | ||
<PropertyDefn> | ||
<Name>id</Name> | ||
<ElementPath>id</ElementPath> | ||
<Type>Integer</Type> | ||
</PropertyDefn> | ||
</GMLFeatureClass> | ||
</GMLFeatureClassList> |
50 changes: 50 additions & 0 deletions
50
python/plugins/processing/tests/testdata/custom/polygonize_lines.gml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?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.8</gml:X><gml:Y>-0.4</gml:Y></gml:coord> | ||
<gml:coord><gml:X>0.8</gml:X><gml:Y>0.8</gml:Y></gml:coord> | ||
</gml:Box> | ||
</gml:boundedBy> | ||
|
||
<gml:featureMember> | ||
<ogr:polygonize_lines fid="polygonize_lines.0"> | ||
<ogr:geometryProperty><gml:LineString srsName="EPSG:4326"><gml:coordinates>-0.6,-0.4 -0.6,0.6 0.6,0.6</gml:coordinates></gml:LineString></ogr:geometryProperty> | ||
<ogr:id>1</ogr:id> | ||
</ogr:polygonize_lines> | ||
</gml:featureMember> | ||
<gml:featureMember> | ||
<ogr:polygonize_lines fid="polygonize_lines.1"> | ||
<ogr:geometryProperty><gml:LineString srsName="EPSG:4326"><gml:coordinates>-0.0,0.8 0,0</gml:coordinates></gml:LineString></ogr:geometryProperty> | ||
<ogr:id>3</ogr:id> | ||
</ogr:polygonize_lines> | ||
</gml:featureMember> | ||
<gml:featureMember> | ||
<ogr:polygonize_lines fid="polygonize_lines.2"> | ||
<ogr:geometryProperty><gml:LineString srsName="EPSG:4326"><gml:coordinates>0.2,0.4 -0.8,0.4</gml:coordinates></gml:LineString></ogr:geometryProperty> | ||
<ogr:id>2</ogr:id> | ||
</ogr:polygonize_lines> | ||
</gml:featureMember> | ||
<gml:featureMember> | ||
<ogr:polygonize_lines fid="polygonize_lines.3"> | ||
<ogr:geometryProperty><gml:LineString srsName="EPSG:4326"><gml:coordinates>-0.8,0.2 0.6,0.2 -0.8,-0.4</gml:coordinates></gml:LineString></ogr:geometryProperty> | ||
<ogr:id>5</ogr:id> | ||
</ogr:polygonize_lines> | ||
</gml:featureMember> | ||
<gml:featureMember> | ||
<ogr:polygonize_lines fid="polygonize_lines.4"> | ||
<ogr:geometryProperty><gml:LineString srsName="EPSG:4326"><gml:coordinates>0.8,0.6 0.8,0.0</gml:coordinates></gml:LineString></ogr:geometryProperty> | ||
<ogr:id>4</ogr:id> | ||
</ogr:polygonize_lines> | ||
</gml:featureMember> | ||
<gml:featureMember> | ||
<ogr:polygonize_lines fid="polygonize_lines.5"> | ||
<ogr:geometryProperty><gml:LineString srsName="EPSG:4326"><gml:coordinates>0.8,0.6 0.8,0.0</gml:coordinates></gml:LineString></ogr:geometryProperty> | ||
<ogr:id>6</ogr:id> | ||
</ogr:polygonize_lines> | ||
</gml:featureMember> | ||
</ogr:FeatureCollection> |
26 changes: 26 additions & 0 deletions
26
python/plugins/processing/tests/testdata/expected/polygonize.gfs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<GMLFeatureClassList> | ||
<GMLFeatureClass> | ||
<Name>polygonize</Name> | ||
<ElementPath>polygonize</ElementPath> | ||
<!--POLYGON--> | ||
<GeometryType>3</GeometryType> | ||
<SRSName>EPSG:4326</SRSName> | ||
<DatasetSpecificInfo> | ||
<FeatureCount>3</FeatureCount> | ||
<ExtentXMin>-0.60000</ExtentXMin> | ||
<ExtentXMax>0.60000</ExtentXMax> | ||
<ExtentYMin>-0.31429</ExtentYMin> | ||
<ExtentYMax>0.60000</ExtentYMax> | ||
</DatasetSpecificInfo> | ||
<PropertyDefn> | ||
<Name>area</Name> | ||
<ElementPath>area</ElementPath> | ||
<Type>Real</Type> | ||
</PropertyDefn> | ||
<PropertyDefn> | ||
<Name>perimeter</Name> | ||
<ElementPath>perimeter</ElementPath> | ||
<Type>Real</Type> | ||
</PropertyDefn> | ||
</GMLFeatureClass> | ||
</GMLFeatureClassList> |
35 changes: 35 additions & 0 deletions
35
python/plugins/processing/tests/testdata/expected/polygonize.gml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?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.6</gml:X><gml:Y>-0.3142857142857143</gml:Y></gml:coord> | ||
<gml:coord><gml:X>0.6</gml:X><gml:Y>0.6</gml:Y></gml:coord> | ||
</gml:Box> | ||
</gml:boundedBy> | ||
|
||
<gml:featureMember> | ||
<ogr:polygonize fid="polygonize.0"> | ||
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-0.6,0.2 0.0,0.2 0.6,0.2 -0.6,-0.314285714285714 -0.6,0.2</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty> | ||
<ogr:area>0.31</ogr:area> | ||
<ogr:perimeter>3.02</ogr:perimeter> | ||
</ogr:polygonize> | ||
</gml:featureMember> | ||
<gml:featureMember> | ||
<ogr:polygonize fid="polygonize.1"> | ||
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>0.0,0.2 -0.6,0.2 -0.6,0.4 0.0,0.4 0.0,0.2</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty> | ||
<ogr:area>0.12</ogr:area> | ||
<ogr:perimeter>1.60</ogr:perimeter> | ||
</ogr:polygonize> | ||
</gml:featureMember> | ||
<gml:featureMember> | ||
<ogr:polygonize fid="polygonize.2"> | ||
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-0.6,0.4 -0.6,0.6 0.0,0.6 0.0,0.4 -0.6,0.4</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty> | ||
<ogr:area>0.12</ogr:area> | ||
<ogr:perimeter>1.60</ogr:perimeter> | ||
</ogr:polygonize> | ||
</gml:featureMember> | ||
</ogr:FeatureCollection> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters