Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
added buffer tests
  • Loading branch information
anitagraser authored and m-kuhn committed Mar 27, 2016
1 parent e922ba3 commit b8d1fb6
Show file tree
Hide file tree
Showing 5 changed files with 189 additions and 0 deletions.
52 changes: 52 additions & 0 deletions python/plugins/processing/tests/testdata/expected/buffer_polys.gml
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ogr.maptools.org/ buffer_polys.xsd"
xmlns:ogr="http://ogr.maptools.org/"
xmlns:gml="http://www.opengis.net/gml">
<gml:boundedBy>
<gml:Box>
<gml:coord><gml:X>-1.5</gml:X><gml:Y>-3.5</gml:Y></gml:coord>
<gml:coord><gml:X>10.5</gml:X><gml:Y>6.5</gml:Y></gml:coord>
</gml:Box>
</gml:boundedBy>

<gml:featureMember>
<ogr:buffer_polys fid="polys.0">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-1.0,-1.5 -1.154508497187476,-1.475528258147576 -1.293892626146238,-1.404508497187473 -1.404508497187475,-1.293892626146235 -1.475528258147577,-1.154508497187473 -1.5,-1.0 -1.5,3.0 -1.475528258147577,3.154508497187474 -1.404508497187474,3.293892626146237 -1.293892626146237,3.404508497187474 -1.154508497187474,3.475528258147577 -1.0,3.5 3.0,3.5 3.154508497187474,3.475528258147577 3.293892626146237,3.404508497187474 3.404508497187474,3.293892626146237 3.475528258147577,3.154508497187474 3.5,3.0 3.5,2.0 3.475528258147577,1.845491502812526 3.404508497187474,1.706107373853763 3.293892626146237,1.595491502812526 3.154508497187474,1.524471741852423 3.0,1.5 2.5,1.5 2.5,-1.0 2.475528258147577,-1.154508497187474 2.404508497187474,-1.293892626146237 2.293892626146237,-1.404508497187474 2.154508497187474,-1.475528258147577 2.0,-1.5 -1.0,-1.5</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:name>aaaaa</ogr:name>
<ogr:intval>33</ogr:intval>
<ogr:floatval>44.123456</ogr:floatval>
</ogr:buffer_polys>
</gml:featureMember>
<gml:featureMember>
<ogr:buffer_polys fid="polys.1">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>4.646446609406726,5.353553390593274 4.773004750130227,5.445503262094184 4.921782767479884,5.493844170297569 5.078217232520116,5.493844170297569 5.226995249869773,5.445503262094184 5.353553390593274,5.353553390593274 6.353553390593274,4.353553390593274 6.440960632174178,4.235698368412999 6.490392640201615,4.097545161008064 6.497592363336098,3.95099142983522 6.461939766255643,3.808658283817455 6.386505226681368,3.682803357918177 6.277785116509802,3.584265193848728 6.145142338627231,3.521529832133896 6.0,3.5 4.0,3.5 3.834860469022414,3.528058334845817 3.688255099070632,3.609084258765987 3.576637900385857,3.733983961742333 3.512536043909088,3.888739533021844 3.503143895053379,4.055982238051655 3.549515566048791,4.21694186955878 3.646446609406726,4.353553390593274 4.646446609406726,5.353553390593274</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:name>Aaaaa</ogr:name>
<ogr:intval>-33</ogr:intval>
<ogr:floatval>0</ogr:floatval>
</ogr:buffer_polys>
</gml:featureMember>
<gml:featureMember>
<ogr:buffer_polys fid="polys.2">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>2.0,4.5 1.845491502812524,4.524471741852424 1.706107373853762,4.595491502812528 1.595491502812525,4.706107373853764 1.524471741852423,4.845491502812527 1.5,5.0 1.5,6.0 1.524471741852423,6.154508497187474 1.595491502812526,6.293892626146237 1.706107373853764,6.404508497187473 1.845491502812526,6.475528258147577 2.0,6.5 3.0,6.5 3.154508497187474,6.475528258147577 3.293892626146237,6.404508497187473 3.404508497187474,6.293892626146237 3.475528258147577,6.154508497187473 3.5,6.0 3.5,5.0 3.475528258147577,4.845491502812527 3.404508497187474,4.706107373853763 3.293892626146237,4.595491502812527 3.154508497187474,4.524471741852423 3.0,4.5 2.0,4.5</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:name>bbaaa</ogr:name>
<ogr:floatval>0.123</ogr:floatval>
</ogr:buffer_polys>
</gml:featureMember>
<gml:featureMember>
<ogr:buffer_polys fid="polys.3">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>5.5,1.0 5.524471741852423,1.154508497187474 5.595491502812527,1.293892626146237 5.706107373853763,1.404508497187474 5.845491502812527,1.475528258147577 6.0,1.5 10.0,1.5 10.154508497187473,1.475528258147577 10.293892626146237,1.404508497187474 10.404508497187473,1.293892626146237 10.475528258147577,1.154508497187474 10.5,1.0 10.5,-3.0 10.475528258147577,-3.154508497187474 10.404508497187473,-3.293892626146237 10.293892626146237,-3.404508497187474 10.154508497187473,-3.475528258147577 10.0,-3.5 6.0,-3.5 5.845491502812524,-3.475528258147576 5.706107373853762,-3.404508497187472 5.595491502812526,-3.293892626146235 5.524471741852423,-3.154508497187473 5.5,-3.0 5.5,1.0</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs><gml:innerBoundaryIs><gml:LinearRing><gml:coordinates>7.5,-0.5 7.5,-1.5 8.5,-1.5 8.5,-0.5 7.5,-0.5</gml:coordinates></gml:LinearRing></gml:innerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:name>ASDF</ogr:name>
<ogr:intval>0</ogr:intval>
</ogr:buffer_polys>
</gml:featureMember>
<gml:featureMember>
<ogr:buffer_polys fid="polys.5">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>3.0,2.5 3.158113883008419,2.474341649025257 6.158113883008419,1.474341649025257 6.296190906059295,1.402828682156291 6.40562109258778,1.292355142331883 6.475820631275006,1.153605751367112 6.5,1.0 6.5,-3.0 6.471531536948011,-3.166306974187634 6.389367961346215,-3.313675932575473 6.262865556059567,-3.42532540417602 6.10642963729163,-3.488541433561138 5.9378741657362,-3.496125367943453 5.776393202250021,-3.447213595499958 1.776393202250021,-1.447213595499958 1.662695537258234,-1.369087658171455 1.574674595823979,-1.262865556059565 1.519030821108041,-1.136633264456335 1.5,-1.0 1.5,2.0 1.524471741852423,2.154508497187474 1.595491502812526,2.293892626146237 1.706107373853764,2.404508497187474 1.845491502812526,2.475528258147577 2.0,2.5 3.0,2.5</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:name>elim</ogr:name>
<ogr:intval>2</ogr:intval>
<ogr:floatval>3.33</ogr:floatval>
</ogr:buffer_polys>
</gml:featureMember>
</ogr:FeatureCollection>
43 changes: 43 additions & 0 deletions python/plugins/processing/tests/testdata/expected/buffer_polys.xsd
@@ -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="buffer_polys" type="ogr:buffer_polys_Type" substitutionGroup="gml:_Feature"/>
<xs:complexType name="buffer_polys_Type">
<xs:complexContent>
<xs:extension base="gml:AbstractFeatureType">
<xs:sequence>
<xs:element name="geometryProperty" type="gml:PolygonPropertyType" nillable="true" minOccurs="0" maxOccurs="1"/>
<xs:element name="name" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="5"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="intval" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:totalDigits value="10"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="floatval" 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>
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ogr.maptools.org/ buffer_polys_dissolve.xsd"
xmlns:ogr="http://ogr.maptools.org/"
xmlns:gml="http://www.opengis.net/gml">
<gml:boundedBy>
<gml:Box>
<gml:coord><gml:X>-1.5</gml:X><gml:Y>-3.5</gml:Y></gml:coord>
<gml:coord><gml:X>10.5</gml:X><gml:Y>6.5</gml:Y></gml:coord>
</gml:Box>
</gml:boundedBy>

<gml:featureMember>
<ogr:buffer_polys_dissolve fid="polys.5">
<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:4326"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-1.0,-1.5 -1.154508497187476,-1.475528258147576 -1.293892626146238,-1.404508497187473 -1.404508497187475,-1.293892626146235 -1.475528258147577,-1.154508497187473 -1.5,-1.0 -1.5,3.0 -1.475528258147577,3.154508497187474 -1.404508497187474,3.293892626146237 -1.293892626146237,3.404508497187474 -1.154508497187474,3.475528258147577 -1.0,3.5 3.0,3.5 3.154508497187474,3.475528258147577 3.293892626146237,3.404508497187474 3.404508497187474,3.293892626146237 3.475528258147577,3.154508497187474 3.5,3.0 3.5,2.360379610028063 6.08113883008419,1.5 10.0,1.5 10.154508497187473,1.475528258147577 10.293892626146237,1.404508497187474 10.404508497187473,1.293892626146237 10.475528258147577,1.154508497187474 10.5,1.0 10.5,-3.0 10.475528258147577,-3.154508497187474 10.404508497187473,-3.293892626146237 10.293892626146237,-3.404508497187474 10.154508497187473,-3.475528258147577 10.0,-3.5 6.0,-3.5 5.967204424203256,-3.494805691082312 5.9378741657362,-3.496125367943453 5.896595974946731,-3.483622411364634 5.845491502812524,-3.475528258147576 5.8097507214254,-3.457317420446019 5.776393202250021,-3.447213595499958 1.881966011250105,-1.5 -1.0,-1.5</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs><gml:innerBoundaryIs><gml:LinearRing><gml:coordinates>7.5,-0.5 7.5,-1.5 8.5,-1.5 8.5,-0.5 7.5,-0.5</gml:coordinates></gml:LinearRing></gml:innerBoundaryIs></gml:Polygon></gml:polygonMember><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>4.646446609406726,5.353553390593274 4.773004750130227,5.445503262094184 4.921782767479884,5.493844170297569 5.078217232520116,5.493844170297569 5.226995249869773,5.445503262094184 5.353553390593274,5.353553390593274 6.353553390593274,4.353553390593274 6.440960632174178,4.235698368412999 6.490392640201615,4.097545161008064 6.497592363336098,3.95099142983522 6.461939766255643,3.808658283817455 6.386505226681368,3.682803357918177 6.277785116509802,3.584265193848728 6.145142338627231,3.521529832133896 6.0,3.5 4.0,3.5 3.834860469022414,3.528058334845817 3.688255099070632,3.609084258765987 3.576637900385857,3.733983961742333 3.512536043909088,3.888739533021844 3.503143895053379,4.055982238051655 3.549515566048791,4.21694186955878 3.646446609406726,4.353553390593274 4.646446609406726,5.353553390593274</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>2.0,4.5 1.845491502812524,4.524471741852424 1.706107373853762,4.595491502812528 1.595491502812525,4.706107373853764 1.524471741852423,4.845491502812527 1.5,5.0 1.5,6.0 1.524471741852423,6.154508497187474 1.595491502812526,6.293892626146237 1.706107373853764,6.404508497187473 1.845491502812526,6.475528258147577 2.0,6.5 3.0,6.5 3.154508497187474,6.475528258147577 3.293892626146237,6.404508497187473 3.404508497187474,6.293892626146237 3.475528258147577,6.154508497187473 3.5,6.0 3.5,5.0 3.475528258147577,4.845491502812527 3.404508497187474,4.706107373853763 3.293892626146237,4.595491502812527 3.154508497187474,4.524471741852423 3.0,4.5 2.0,4.5</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogr:geometryProperty>
<ogr:name>elim</ogr:name>
<ogr:intval>2</ogr:intval>
<ogr:floatval>3.33</ogr:floatval>
</ogr:buffer_polys_dissolve>
</gml:featureMember>
</ogr:FeatureCollection>
@@ -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="buffer_polys_dissolve" type="ogr:buffer_polys_dissolve_Type" substitutionGroup="gml:_Feature"/>
<xs:complexType name="buffer_polys_dissolve_Type">
<xs:complexContent>
<xs:extension base="gml:AbstractFeatureType">
<xs:sequence>
<xs:element name="geometryProperty" type="gml:PolygonPropertyType" nillable="true" minOccurs="0" maxOccurs="1"/>
<xs:element name="name" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="5"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="intval" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:totalDigits value="10"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="floatval" 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>
29 changes: 29 additions & 0 deletions python/plugins/processing/tests/testdata/qgis_algorithm_tests.yaml
Expand Up @@ -229,3 +229,32 @@ tests:
type: vector
name: expected/PolygonDissolveTest_output.gml


- algorithm: qgis:fixeddistancebuffer
name: Basic polygon buffer
params:
DISSOLVE: 'False'
DISTANCE: 0.5
INPUT:
name: polys.gml
type: vector
SEGMENTS: 5
results:
OUTPUT:
name: expected/buffer_polys.gml
type: vector


- algorithm: qgis:fixeddistancebuffer
name: Polygon buffer with dissolve
params:
DISSOLVE: 'True'
DISTANCE: 0.5
INPUT:
name: polys.gml
type: vector
SEGMENTS: 5
results:
OUTPUT:
name: expected/buffer_polys_dissolve.gml
type: vector

0 comments on commit b8d1fb6

Please sign in to comment.