Skip to content

Commit

Permalink
[processing] Add tests for create points from table alg
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Nov 23, 2016
1 parent 69e8e4a commit d742478
Show file tree
Hide file tree
Showing 5 changed files with 287 additions and 0 deletions.
40 changes: 40 additions & 0 deletions python/plugins/processing/tests/testdata/create_points.gfs
@@ -0,0 +1,40 @@
<GMLFeatureClassList>
<GMLFeatureClass>
<Name>create_points</Name>
<ElementPath>create_points</ElementPath>
<GeometryType>100</GeometryType>
<DatasetSpecificInfo>
<FeatureCount>9</FeatureCount>
</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>xcoord</Name>
<ElementPath>xcoord</ElementPath>
<Type>Real</Type>
</PropertyDefn>
<PropertyDefn>
<Name>ycoord</Name>
<ElementPath>ycoord</ElementPath>
<Type>Real</Type>
</PropertyDefn>
<PropertyDefn>
<Name>zcoord</Name>
<ElementPath>zcoord</ElementPath>
<Type>Real</Type>
</PropertyDefn>
<PropertyDefn>
<Name>mcoord</Name>
<ElementPath>mcoord</ElementPath>
<Type>Real</Type>
</PropertyDefn>
</GMLFeatureClass>
</GMLFeatureClassList>
87 changes: 87 additions & 0 deletions python/plugins/processing/tests/testdata/create_points.gml
@@ -0,0 +1,87 @@
<?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:null>missing</gml:null></gml:boundedBy>

<gml:featureMember>
<ogr:create_points fid="points.0">
<ogr:id>1</ogr:id>
<ogr:id2>2</ogr:id2>
<ogr:xcoord>1.00000</ogr:xcoord>
<ogr:ycoord>1.00000</ogr:ycoord>
<ogr:zcoord>1.00000</ogr:zcoord>
</ogr:create_points>
</gml:featureMember>
<gml:featureMember>
<ogr:create_points fid="points.1">
<ogr:id>2</ogr:id>
<ogr:id2>1</ogr:id2>
<ogr:xcoord>3.00000</ogr:xcoord>
<ogr:ycoord>3.00000</ogr:ycoord>
<ogr:zcoord>2.00000</ogr:zcoord>
<ogr:mcoord>4.00000</ogr:mcoord>
</ogr:create_points>
</gml:featureMember>
<gml:featureMember>
<ogr:create_points fid="points.2">
<ogr:id>3</ogr:id>
<ogr:id2>0</ogr:id2>
<ogr:xcoord>2.00000</ogr:xcoord>
<ogr:ycoord>2.00000</ogr:ycoord>
<ogr:zcoord>3.00000</ogr:zcoord>
<ogr:mcoord>5.00000</ogr:mcoord>
</ogr:create_points>
</gml:featureMember>
<gml:featureMember>
<ogr:create_points fid="points.3">
<ogr:id>4</ogr:id>
<ogr:id2>2</ogr:id2>
<ogr:xcoord>5.00000</ogr:xcoord>
<ogr:ycoord>2.00000</ogr:ycoord>
</ogr:create_points>
</gml:featureMember>
<gml:featureMember>
<ogr:create_points fid="points.4">
<ogr:id>5</ogr:id>
<ogr:id2>1</ogr:id2>
</ogr:create_points>
</gml:featureMember>
<gml:featureMember>
<ogr:create_points fid="points.5">
<ogr:id>6</ogr:id>
<ogr:id2>0</ogr:id2>
<ogr:ycoord>-5.00000</ogr:ycoord>
<ogr:mcoord>8.00000</ogr:mcoord>
</ogr:create_points>
</gml:featureMember>
<gml:featureMember>
<ogr:create_points fid="points.6">
<ogr:id>7</ogr:id>
<ogr:id2>0</ogr:id2>
<ogr:xcoord>8.00000</ogr:xcoord>
</ogr:create_points>
</gml:featureMember>
<gml:featureMember>
<ogr:create_points fid="points.7">
<ogr:id>8</ogr:id>
<ogr:id2>0</ogr:id2>
<ogr:xcoord>7.00000</ogr:xcoord>
<ogr:ycoord>-1.00000</ogr:ycoord>
<ogr:zcoord>4.00000</ogr:zcoord>
<ogr:mcoord>6.00000</ogr:mcoord>
</ogr:create_points>
</gml:featureMember>
<gml:featureMember>
<ogr:create_points fid="points.8">
<ogr:id>9</ogr:id>
<ogr:id2>0</ogr:id2>
<ogr:xcoord>0.00000</ogr:xcoord>
<ogr:ycoord>-1.00000</ogr:ycoord>
<ogr:zcoord>5.00000</ogr:zcoord>
<ogr:mcoord>7.00000</ogr:mcoord>
</ogr:create_points>
</gml:featureMember>
</ogr:FeatureCollection>
@@ -0,0 +1,46 @@
<GMLFeatureClassList>
<GMLFeatureClass>
<Name>create_points</Name>
<ElementPath>create_points</ElementPath>
<!--POINTZ-->
<GeometryType>-2147483647</GeometryType>
<SRSName>EPSG:4326</SRSName>
<DatasetSpecificInfo>
<FeatureCount>9</FeatureCount>
<ExtentXMin>0.00000</ExtentXMin>
<ExtentXMax>7.00000</ExtentXMax>
<ExtentYMin>-1.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>xcoord</Name>
<ElementPath>xcoord</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
<PropertyDefn>
<Name>ycoord</Name>
<ElementPath>ycoord</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
<PropertyDefn>
<Name>zcoord</Name>
<ElementPath>zcoord</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
<PropertyDefn>
<Name>mcoord</Name>
<ElementPath>mcoord</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
</GMLFeatureClass>
</GMLFeatureClassList>
@@ -0,0 +1,98 @@
<?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>-1</gml:Y><gml:Z>0</gml:Z></gml:coord>
<gml:coord><gml:X>7</gml:X><gml:Y>3</gml:Y><gml:Z>5</gml:Z></gml:coord>
</gml:Box>
</gml:boundedBy>

<gml:featureMember>
<ogr:create_points fid="points.0">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>1,1,1</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:id>1</ogr:id>
<ogr:id2>2</ogr:id2>
<ogr:xcoord>1</ogr:xcoord>
<ogr:ycoord>1</ogr:ycoord>
<ogr:zcoord>1</ogr:zcoord>
</ogr:create_points>
</gml:featureMember>
<gml:featureMember>
<ogr:create_points fid="points.1">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>3,3,2</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:id>2</ogr:id>
<ogr:id2>1</ogr:id2>
<ogr:xcoord>3</ogr:xcoord>
<ogr:ycoord>3</ogr:ycoord>
<ogr:zcoord>2</ogr:zcoord>
<ogr:mcoord>4</ogr:mcoord>
</ogr:create_points>
</gml:featureMember>
<gml:featureMember>
<ogr:create_points fid="points.2">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>2,2,3</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:id>3</ogr:id>
<ogr:id2>0</ogr:id2>
<ogr:xcoord>2</ogr:xcoord>
<ogr:ycoord>2</ogr:ycoord>
<ogr:zcoord>3</ogr:zcoord>
<ogr:mcoord>5</ogr:mcoord>
</ogr:create_points>
</gml:featureMember>
<gml:featureMember>
<ogr:create_points fid="points.3">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>5,2,0</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:id>4</ogr:id>
<ogr:id2>2</ogr:id2>
<ogr:xcoord>5</ogr:xcoord>
<ogr:ycoord>2</ogr:ycoord>
</ogr:create_points>
</gml:featureMember>
<gml:featureMember>
<ogr:create_points fid="points.4">
<ogr:id>5</ogr:id>
<ogr:id2>1</ogr:id2>
</ogr:create_points>
</gml:featureMember>
<gml:featureMember>
<ogr:create_points fid="points.5">
<ogr:id>6</ogr:id>
<ogr:id2>0</ogr:id2>
<ogr:ycoord>-5</ogr:ycoord>
<ogr:mcoord>8</ogr:mcoord>
</ogr:create_points>
</gml:featureMember>
<gml:featureMember>
<ogr:create_points fid="points.6">
<ogr:id>7</ogr:id>
<ogr:id2>0</ogr:id2>
<ogr:xcoord>8</ogr:xcoord>
</ogr:create_points>
</gml:featureMember>
<gml:featureMember>
<ogr:create_points fid="points.7">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>7,-1,4</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:id>8</ogr:id>
<ogr:id2>0</ogr:id2>
<ogr:xcoord>7</ogr:xcoord>
<ogr:ycoord>-1</ogr:ycoord>
<ogr:zcoord>4</ogr:zcoord>
<ogr:mcoord>6</ogr:mcoord>
</ogr:create_points>
</gml:featureMember>
<gml:featureMember>
<ogr:create_points fid="points.8">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>0,-1,5</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:id>9</ogr:id>
<ogr:id2>0</ogr:id2>
<ogr:xcoord>0</ogr:xcoord>
<ogr:ycoord>-1</ogr:ycoord>
<ogr:zcoord>5</ogr:zcoord>
<ogr:mcoord>7</ogr:mcoord>
</ogr:create_points>
</gml:featureMember>
</ogr:FeatureCollection>
16 changes: 16 additions & 0 deletions python/plugins/processing/tests/testdata/qgis_algorithm_tests.yaml
Expand Up @@ -1576,3 +1576,19 @@ tests:
OUTPUT:
name: expected/delete_column.gml
type: vector

- algorithm: qgis:createpointslayerfromtable
name: Create points from table
params:
INPUT:
name: create_points.gml
type: table
MFIELD: mcoord
TARGET_CRS: EPSG:4326
XFIELD: xcoord
YFIELD: ycoord
ZFIELD: zcoord
results:
OUTPUT:
name: expected/create_points.gml
type: vector

0 comments on commit d742478

Please sign in to comment.