mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-16 00:03:12 -04:00
[processing] Hide redundant grid creation algorithms
Condenses the duplicate grid algorithms into single algorithms (one for line, one for polygon), taking the best bits from both and adding tests
This commit is contained in:
parent
7e0cd9af3d
commit
772b769403
@ -99,12 +99,19 @@ qgis:createattributeindex: >
|
|||||||
qgis:createconstantrasterlayer: >
|
qgis:createconstantrasterlayer: >
|
||||||
Given an input raster layer an a value, this algorithm generates a new layer with the same extent and cellsize as the input one, and all cells with the specified value.
|
Given an input raster layer an a value, this algorithm generates a new layer with the same extent and cellsize as the input one, and all cells with the specified value.
|
||||||
|
|
||||||
qgis:creategrid:
|
qgis:creategridlines:
|
||||||
This algorithm creates a vector layer with a grid convering a given extent. Features can be lines or polygons, and the shape used in the grid can be rectangles, diamond or hexagons.
|
This algorithm creates a line vector layer with a grid covering a given extent.
|
||||||
|
|
||||||
The size of each element in the grid is defined using a horizontal and vertical spaciong.
|
The size of each element in the grid is defined using a horizontal and vertical spacing.
|
||||||
|
|
||||||
The CRS of the output layer must be defined. The grid extent and the spacing values are supposed to be expressed in the coordinates and units of this CRS.
|
The CRS of the output layer must be defined. The grid extent and the spacing values must be expressed in the coordinates and units of this CRS.
|
||||||
|
|
||||||
|
qgis:creategridpolygon:
|
||||||
|
This algorithm creates a polygon vector layer with a grid covering a given extent. The grid shape can be rectangles, diamond or hexagons.
|
||||||
|
|
||||||
|
The size of each element in the grid is defined using a horizontal and vertical spacing.
|
||||||
|
|
||||||
|
The CRS of the output layer must be defined. The grid extent and the spacing values must be expressed in the coordinates and units of this CRS.
|
||||||
|
|
||||||
qgis:createpointsalonglines: >
|
qgis:createpointsalonglines: >
|
||||||
This algorithms creates a points layer, with points distributed along the lines of an input vector layer. the distance between points (measured along the line) is defined as a parameter.
|
This algorithms creates a points layer, with points distributed along the lines of an input vector layer. the distance between points (measured along the line) is defined as a parameter.
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
"""
|
"""
|
||||||
from builtins import range
|
|
||||||
|
|
||||||
__author__ = 'Michael Minn'
|
__author__ = 'Michael Minn'
|
||||||
__date__ = 'May 2010'
|
__date__ = 'May 2010'
|
||||||
@ -29,8 +28,17 @@ __revision__ = '$Format:%H$'
|
|||||||
import os
|
import os
|
||||||
import math
|
import math
|
||||||
|
|
||||||
|
from qgis.PyQt.QtGui import QIcon
|
||||||
from qgis.PyQt.QtCore import QVariant
|
from qgis.PyQt.QtCore import QVariant
|
||||||
from qgis.core import QgsRectangle, QgsCoordinateReferenceSystem, Qgis, QgsField, QgsFeature, QgsGeometry, QgsPoint, QgsWkbTypes
|
from qgis.core import (QgsRectangle,
|
||||||
|
QgsCoordinateReferenceSystem,
|
||||||
|
Qgis,
|
||||||
|
QgsField,
|
||||||
|
QgsFeature,
|
||||||
|
QgsGeometry,
|
||||||
|
QgsPointV2,
|
||||||
|
QgsLineString,
|
||||||
|
QgsWkbTypes)
|
||||||
from processing.core.GeoAlgorithm import GeoAlgorithm
|
from processing.core.GeoAlgorithm import GeoAlgorithm
|
||||||
from processing.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException
|
from processing.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException
|
||||||
from processing.core.parameters import ParameterExtent
|
from processing.core.parameters import ParameterExtent
|
||||||
@ -49,20 +57,21 @@ class GridLine(GeoAlgorithm):
|
|||||||
CRS = 'CRS'
|
CRS = 'CRS'
|
||||||
OUTPUT = 'OUTPUT'
|
OUTPUT = 'OUTPUT'
|
||||||
|
|
||||||
#def getIcon(self):
|
def getIcon(self):
|
||||||
# return QIcon(os.path.join(pluginPath, 'images', 'ftools', 'vector_grid.png'))
|
return QIcon(os.path.join(pluginPath, 'images', 'ftools', 'vector_grid.png'))
|
||||||
|
|
||||||
def defineCharacteristics(self):
|
def defineCharacteristics(self):
|
||||||
self.name, self.i18n_name = self.trAlgorithm('Create grid (lines)')
|
self.name, self.i18n_name = self.trAlgorithm('Create grid (lines)')
|
||||||
self.group, self.i18n_group = self.trAlgorithm('Vector creation tools')
|
self.group, self.i18n_group = self.trAlgorithm('Vector creation tools')
|
||||||
|
self.tags = self.tr('grid,lines,vector,create,fishnet')
|
||||||
|
|
||||||
self.addParameter(ParameterExtent(self.EXTENT,
|
self.addParameter(ParameterExtent(self.EXTENT,
|
||||||
self.tr('Grid extent'), optional=False))
|
self.tr('Grid extent'), optional=False))
|
||||||
self.addParameter(ParameterNumber(self.HSPACING,
|
self.addParameter(ParameterNumber(self.HSPACING,
|
||||||
self.tr('Horizontal spacing'), default=10.0))
|
self.tr('Horizontal spacing'), 0.0, 1000000000.0, default=0.0001))
|
||||||
self.addParameter(ParameterNumber(self.VSPACING,
|
self.addParameter(ParameterNumber(self.VSPACING,
|
||||||
self.tr('Vertical spacing'), default=10.0))
|
self.tr('Vertical spacing'), 0.0, 1000000000.0, default=0.0001))
|
||||||
self.addParameter(ParameterCrs(self.CRS, 'Grid CRS'))
|
self.addParameter(ParameterCrs(self.CRS, 'Grid CRS', 'EPSG:4326'))
|
||||||
|
|
||||||
self.addOutput(OutputVector(self.OUTPUT, self.tr('Grid'), datatype=[dataobjects.TYPE_VECTOR_LINE]))
|
self.addOutput(OutputVector(self.OUTPUT, self.tr('Grid'), datatype=[dataobjects.TYPE_VECTOR_LINE]))
|
||||||
|
|
||||||
@ -77,8 +86,6 @@ class GridLine(GeoAlgorithm):
|
|||||||
|
|
||||||
width = bbox.width()
|
width = bbox.width()
|
||||||
height = bbox.height()
|
height = bbox.height()
|
||||||
originX = bbox.xMinimum()
|
|
||||||
originY = bbox.yMaximum()
|
|
||||||
|
|
||||||
if hSpacing <= 0 or vSpacing <= 0:
|
if hSpacing <= 0 or vSpacing <= 0:
|
||||||
raise GeoAlgorithmExecutionException(
|
raise GeoAlgorithmExecutionException(
|
||||||
@ -95,42 +102,68 @@ class GridLine(GeoAlgorithm):
|
|||||||
fields = [QgsField('left', QVariant.Double, '', 24, 16),
|
fields = [QgsField('left', QVariant.Double, '', 24, 16),
|
||||||
QgsField('top', QVariant.Double, '', 24, 16),
|
QgsField('top', QVariant.Double, '', 24, 16),
|
||||||
QgsField('right', QVariant.Double, '', 24, 16),
|
QgsField('right', QVariant.Double, '', 24, 16),
|
||||||
QgsField('bottom', QVariant.Double, '', 24, 16)
|
QgsField('bottom', QVariant.Double, '', 24, 16),
|
||||||
|
QgsField('id', QVariant.Int, '', 10, 0),
|
||||||
|
QgsField('coord', QVariant.Double, '', 24, 15)
|
||||||
]
|
]
|
||||||
|
|
||||||
writer = self.getOutputFromName(self.OUTPUT).getVectorWriter(fields,
|
writer = self.getOutputFromName(self.OUTPUT).getVectorWriter(fields,
|
||||||
QgsWkbTypes.LineString, crs)
|
QgsWkbTypes.LineString, crs)
|
||||||
|
|
||||||
self._rectangleGridLine(
|
feat = QgsFeature()
|
||||||
writer, width, height, originX, originY, hSpacing, vSpacing)
|
feat.initAttributes(len(fields))
|
||||||
|
|
||||||
def _rectangleGridLine(self, writer, width, height, originX, originY,
|
count = 0
|
||||||
hSpacing, vSpacing):
|
id = 1
|
||||||
ft = QgsFeature()
|
|
||||||
|
|
||||||
columns = int(math.ceil(float(width) / hSpacing))
|
# latitude lines
|
||||||
rows = int(math.ceil(float(height) / vSpacing))
|
count_max = height / vSpacing
|
||||||
|
count_update = count_max * 0.10
|
||||||
|
y = bbox.yMaximum()
|
||||||
|
while y >= bbox.yMinimum():
|
||||||
|
pt1 = QgsPointV2(bbox.xMinimum(), y)
|
||||||
|
pt2 = QgsPointV2(bbox.xMaximum(), y)
|
||||||
|
line = QgsLineString()
|
||||||
|
line.setPoints([pt1, pt2])
|
||||||
|
feat.setGeometry(QgsGeometry(line))
|
||||||
|
feat.setAttributes([bbox.xMinimum(),
|
||||||
|
y,
|
||||||
|
bbox.xMaximum(),
|
||||||
|
y,
|
||||||
|
id,
|
||||||
|
y])
|
||||||
|
writer.addFeature(feat)
|
||||||
|
y = y - vSpacing
|
||||||
|
id += 1
|
||||||
|
count += 1
|
||||||
|
if int(math.fmod(count, count_update)) == 0:
|
||||||
|
progress.setPercentage(int(count / count_max * 50))
|
||||||
|
|
||||||
# Longitude lines
|
progress.setPercentage(50)
|
||||||
for col in range(columns + 1):
|
|
||||||
polyline = []
|
|
||||||
x = originX + (col * hSpacing)
|
|
||||||
for row in range(rows + 1):
|
|
||||||
y = originY - (row * vSpacing)
|
|
||||||
polyline.append(QgsPoint(x, y))
|
|
||||||
|
|
||||||
ft.setGeometry(QgsGeometry.fromPolyline(polyline))
|
# longitude lines
|
||||||
ft.setAttributes([x, originY, x, originY + (rows * vSpacing)])
|
# counters for progressbar - update every 5%
|
||||||
writer.addFeature(ft)
|
count = 0
|
||||||
|
count_max = width / hSpacing
|
||||||
|
count_update = count_max * 0.10
|
||||||
|
x = bbox.xMinimum()
|
||||||
|
while x <= bbox.xMaximum():
|
||||||
|
pt1 = QgsPointV2(x, bbox.yMaximum())
|
||||||
|
pt2 = QgsPointV2(x, bbox.yMinimum())
|
||||||
|
line = QgsLineString()
|
||||||
|
line.setPoints([pt1, pt2])
|
||||||
|
feat.setGeometry(QgsGeometry(line))
|
||||||
|
feat.setAttributes([x,
|
||||||
|
bbox.yMaximum(),
|
||||||
|
x,
|
||||||
|
bbox.yMinimum(),
|
||||||
|
id,
|
||||||
|
x])
|
||||||
|
writer.addFeature(feat)
|
||||||
|
x = x + hSpacing
|
||||||
|
id += 1
|
||||||
|
count += 1
|
||||||
|
if int(math.fmod(count, count_update)) == 0:
|
||||||
|
progress.setPercentage(50 + int(count / count_max * 50))
|
||||||
|
|
||||||
# Latitude lines
|
del writer
|
||||||
for row in range(rows + 1):
|
|
||||||
polyline = []
|
|
||||||
y = originY - (row * vSpacing)
|
|
||||||
for col in range(columns + 1):
|
|
||||||
x = originX + (col * hSpacing)
|
|
||||||
polyline.append(QgsPoint(x, y))
|
|
||||||
|
|
||||||
ft.setGeometry(QgsGeometry.fromPolyline(polyline))
|
|
||||||
ft.setAttributes([originX, y, originX + (col * hSpacing), y])
|
|
||||||
writer.addFeature(ft)
|
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
"""
|
"""
|
||||||
from builtins import range
|
|
||||||
|
|
||||||
__author__ = 'Michael Minn'
|
__author__ = 'Michael Minn'
|
||||||
__date__ = 'May 2010'
|
__date__ = 'May 2010'
|
||||||
@ -29,6 +28,7 @@ __revision__ = '$Format:%H$'
|
|||||||
import os
|
import os
|
||||||
import math
|
import math
|
||||||
|
|
||||||
|
from qgis.PyQt.QtGui import QIcon
|
||||||
from qgis.PyQt.QtCore import QVariant
|
from qgis.PyQt.QtCore import QVariant
|
||||||
from qgis.core import QgsRectangle, QgsCoordinateReferenceSystem, Qgis, QgsField, QgsFeature, QgsGeometry, QgsPoint, QgsWkbTypes
|
from qgis.core import QgsRectangle, QgsCoordinateReferenceSystem, Qgis, QgsField, QgsFeature, QgsGeometry, QgsPoint, QgsWkbTypes
|
||||||
from processing.core.GeoAlgorithm import GeoAlgorithm
|
from processing.core.GeoAlgorithm import GeoAlgorithm
|
||||||
@ -51,12 +51,13 @@ class GridPolygon(GeoAlgorithm):
|
|||||||
CRS = 'CRS'
|
CRS = 'CRS'
|
||||||
OUTPUT = 'OUTPUT'
|
OUTPUT = 'OUTPUT'
|
||||||
|
|
||||||
#def getIcon(self):
|
def getIcon(self):
|
||||||
# return QIcon(os.path.join(pluginPath, 'images', 'ftools', 'vector_grid.png'))
|
return QIcon(os.path.join(pluginPath, 'images', 'ftools', 'vector_grid.png'))
|
||||||
|
|
||||||
def defineCharacteristics(self):
|
def defineCharacteristics(self):
|
||||||
self.name, self.i18n_name = self.trAlgorithm('Create grid (polygon)')
|
self.name, self.i18n_name = self.trAlgorithm('Create grid (polygon)')
|
||||||
self.group, self.i18n_group = self.trAlgorithm('Vector creation tools')
|
self.group, self.i18n_group = self.trAlgorithm('Vector creation tools')
|
||||||
|
self.tags = self.tr('grid,polygons,vector,create,fishnet')
|
||||||
|
|
||||||
self.types = [self.tr('Rectangle (polygon)'),
|
self.types = [self.tr('Rectangle (polygon)'),
|
||||||
self.tr('Diamond (polygon)'),
|
self.tr('Diamond (polygon)'),
|
||||||
@ -67,10 +68,10 @@ class GridPolygon(GeoAlgorithm):
|
|||||||
self.addParameter(ParameterExtent(self.EXTENT,
|
self.addParameter(ParameterExtent(self.EXTENT,
|
||||||
self.tr('Grid extent'), optional=False))
|
self.tr('Grid extent'), optional=False))
|
||||||
self.addParameter(ParameterNumber(self.HSPACING,
|
self.addParameter(ParameterNumber(self.HSPACING,
|
||||||
self.tr('Horizontal spacing'), default=10.0))
|
self.tr('Horizontal spacing'), 0.0, 1000000000.0, 0.0001))
|
||||||
self.addParameter(ParameterNumber(self.VSPACING,
|
self.addParameter(ParameterNumber(self.VSPACING,
|
||||||
self.tr('Vertical spacing'), default=10.0))
|
self.tr('Vertical spacing'), 0.0, 1000000000.0, 0.0001))
|
||||||
self.addParameter(ParameterCrs(self.CRS, 'Grid CRS'))
|
self.addParameter(ParameterCrs(self.CRS, 'Grid CRS', 'EPSG:4326'))
|
||||||
|
|
||||||
self.addOutput(OutputVector(self.OUTPUT, self.tr('Grid'), datatype=[dataobjects.TYPE_VECTOR_POLYGON]))
|
self.addOutput(OutputVector(self.OUTPUT, self.tr('Grid'), datatype=[dataobjects.TYPE_VECTOR_POLYGON]))
|
||||||
|
|
||||||
@ -104,7 +105,8 @@ class GridPolygon(GeoAlgorithm):
|
|||||||
fields = [QgsField('left', QVariant.Double, '', 24, 16),
|
fields = [QgsField('left', QVariant.Double, '', 24, 16),
|
||||||
QgsField('top', QVariant.Double, '', 24, 16),
|
QgsField('top', QVariant.Double, '', 24, 16),
|
||||||
QgsField('right', QVariant.Double, '', 24, 16),
|
QgsField('right', QVariant.Double, '', 24, 16),
|
||||||
QgsField('bottom', QVariant.Double, '', 24, 16)
|
QgsField('bottom', QVariant.Double, '', 24, 16),
|
||||||
|
QgsField('id', QVariant.Int, '', 10, 0)
|
||||||
]
|
]
|
||||||
|
|
||||||
writer = self.getOutputFromName(self.OUTPUT).getVectorWriter(fields,
|
writer = self.getOutputFromName(self.OUTPUT).getVectorWriter(fields,
|
||||||
@ -112,22 +114,27 @@ class GridPolygon(GeoAlgorithm):
|
|||||||
|
|
||||||
if idx == 0:
|
if idx == 0:
|
||||||
self._rectangleGrid(
|
self._rectangleGrid(
|
||||||
writer, width, height, originX, originY, hSpacing, vSpacing)
|
writer, width, height, originX, originY, hSpacing, vSpacing, progress)
|
||||||
elif idx == 1:
|
elif idx == 1:
|
||||||
self._diamondGrid(
|
self._diamondGrid(
|
||||||
writer, width, height, originX, originY, hSpacing, vSpacing)
|
writer, width, height, originX, originY, hSpacing, vSpacing, progress)
|
||||||
elif idx == 2:
|
elif idx == 2:
|
||||||
self._hexagonGrid(
|
self._hexagonGrid(
|
||||||
writer, width, height, originX, originY, hSpacing, vSpacing)
|
writer, width, height, originX, originY, hSpacing, vSpacing, progress)
|
||||||
|
|
||||||
del writer
|
del writer
|
||||||
|
|
||||||
def _rectangleGrid(self, writer, width, height, originX, originY,
|
def _rectangleGrid(self, writer, width, height, originX, originY,
|
||||||
hSpacing, vSpacing):
|
hSpacing, vSpacing, progress):
|
||||||
ft = QgsFeature()
|
ft = QgsFeature()
|
||||||
|
|
||||||
columns = int(math.ceil(float(width) / hSpacing))
|
columns = int(math.ceil(float(width) / hSpacing))
|
||||||
rows = int(math.ceil(float(height) / vSpacing))
|
rows = int(math.ceil(float(height) / vSpacing))
|
||||||
|
cells = rows * columns
|
||||||
|
count_update = cells * 0.05
|
||||||
|
|
||||||
|
id = 1
|
||||||
|
count = 0
|
||||||
|
|
||||||
for col in range(columns):
|
for col in range(columns):
|
||||||
# (column + 1) and (row + 1) calculation is used to maintain
|
# (column + 1) and (row + 1) calculation is used to maintain
|
||||||
@ -147,11 +154,15 @@ class GridPolygon(GeoAlgorithm):
|
|||||||
polyline.append(QgsPoint(x1, y1))
|
polyline.append(QgsPoint(x1, y1))
|
||||||
|
|
||||||
ft.setGeometry(QgsGeometry.fromPolygon([polyline]))
|
ft.setGeometry(QgsGeometry.fromPolygon([polyline]))
|
||||||
ft.setAttributes([x1, y1, x2, y2])
|
ft.setAttributes([x1, y1, x2, y2, id])
|
||||||
writer.addFeature(ft)
|
writer.addFeature(ft)
|
||||||
|
id += 1
|
||||||
|
count += 1
|
||||||
|
if int(math.fmod(count, count_update)) == 0:
|
||||||
|
progress.setPercentage(int(count / cells * 100))
|
||||||
|
|
||||||
def _diamondGrid(self, writer, width, height, originX, originY,
|
def _diamondGrid(self, writer, width, height, originX, originY,
|
||||||
hSpacing, vSpacing):
|
hSpacing, vSpacing, progress):
|
||||||
ft = QgsFeature()
|
ft = QgsFeature()
|
||||||
|
|
||||||
halfHSpacing = hSpacing / 2
|
halfHSpacing = hSpacing / 2
|
||||||
@ -160,6 +171,12 @@ class GridPolygon(GeoAlgorithm):
|
|||||||
columns = int(math.ceil(float(width) / halfHSpacing))
|
columns = int(math.ceil(float(width) / halfHSpacing))
|
||||||
rows = int(math.ceil(float(height) / vSpacing))
|
rows = int(math.ceil(float(height) / vSpacing))
|
||||||
|
|
||||||
|
cells = rows * columns
|
||||||
|
count_update = cells * 0.05
|
||||||
|
|
||||||
|
id = 1
|
||||||
|
count = 0
|
||||||
|
|
||||||
for col in range(columns):
|
for col in range(columns):
|
||||||
x1 = originX + ((col + 0) * halfHSpacing)
|
x1 = originX + ((col + 0) * halfHSpacing)
|
||||||
x2 = originX + ((col + 1) * halfHSpacing)
|
x2 = originX + ((col + 1) * halfHSpacing)
|
||||||
@ -183,11 +200,15 @@ class GridPolygon(GeoAlgorithm):
|
|||||||
polyline.append(QgsPoint(x1, y2))
|
polyline.append(QgsPoint(x1, y2))
|
||||||
|
|
||||||
ft.setGeometry(QgsGeometry.fromPolygon([polyline]))
|
ft.setGeometry(QgsGeometry.fromPolygon([polyline]))
|
||||||
ft.setAttributes([x1, y1, x3, y3])
|
ft.setAttributes([x1, y1, x3, y3, id])
|
||||||
writer.addFeature(ft)
|
writer.addFeature(ft)
|
||||||
|
id += 1
|
||||||
|
count += 1
|
||||||
|
if int(math.fmod(count, count_update)) == 0:
|
||||||
|
progress.setPercentage(int(count / cells * 100))
|
||||||
|
|
||||||
def _hexagonGrid(self, writer, width, height, originX, originY,
|
def _hexagonGrid(self, writer, width, height, originX, originY,
|
||||||
hSpacing, vSpacing):
|
hSpacing, vSpacing, progress):
|
||||||
ft = QgsFeature()
|
ft = QgsFeature()
|
||||||
|
|
||||||
# To preserve symmetry, hspacing is fixed relative to vspacing
|
# To preserve symmetry, hspacing is fixed relative to vspacing
|
||||||
@ -200,6 +221,12 @@ class GridPolygon(GeoAlgorithm):
|
|||||||
columns = int(math.ceil(float(width) / hSpacing))
|
columns = int(math.ceil(float(width) / hSpacing))
|
||||||
rows = int(math.ceil(float(height) / vSpacing))
|
rows = int(math.ceil(float(height) / vSpacing))
|
||||||
|
|
||||||
|
cells = rows * columns
|
||||||
|
count_update = cells * 0.05
|
||||||
|
|
||||||
|
id = 1
|
||||||
|
count = 0
|
||||||
|
|
||||||
for col in range(columns):
|
for col in range(columns):
|
||||||
# (column + 1) and (row + 1) calculation is used to maintain
|
# (column + 1) and (row + 1) calculation is used to maintain
|
||||||
# topology between adjacent shapes and avoid overlaps/holes
|
# topology between adjacent shapes and avoid overlaps/holes
|
||||||
@ -229,5 +256,9 @@ class GridPolygon(GeoAlgorithm):
|
|||||||
polyline.append(QgsPoint(x1, y2))
|
polyline.append(QgsPoint(x1, y2))
|
||||||
|
|
||||||
ft.setGeometry(QgsGeometry.fromPolygon([polyline]))
|
ft.setGeometry(QgsGeometry.fromPolygon([polyline]))
|
||||||
ft.setAttributes([x1, y1, x4, y3])
|
ft.setAttributes([x1, y1, x4, y3, id])
|
||||||
writer.addFeature(ft)
|
writer.addFeature(ft)
|
||||||
|
id += 1
|
||||||
|
count += 1
|
||||||
|
if int(math.fmod(count, count_update)) == 0:
|
||||||
|
progress.setPercentage(int(count / cells * 100))
|
||||||
|
@ -50,6 +50,11 @@ class VectorGridLines(GeoAlgorithm):
|
|||||||
STEP_Y = 'STEP_Y'
|
STEP_Y = 'STEP_Y'
|
||||||
OUTPUT = 'OUTPUT'
|
OUTPUT = 'OUTPUT'
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
GeoAlgorithm.__init__(self)
|
||||||
|
# this algorithm is deprecated - use GridLine instead
|
||||||
|
self.showInToolbox = False
|
||||||
|
|
||||||
def getIcon(self):
|
def getIcon(self):
|
||||||
return QIcon(os.path.join(pluginPath, 'images', 'ftools', 'vector_grid.png'))
|
return QIcon(os.path.join(pluginPath, 'images', 'ftools', 'vector_grid.png'))
|
||||||
|
|
||||||
@ -58,7 +63,7 @@ class VectorGridLines(GeoAlgorithm):
|
|||||||
self.group, self.i18n_group = self.trAlgorithm('Vector creation tools')
|
self.group, self.i18n_group = self.trAlgorithm('Vector creation tools')
|
||||||
|
|
||||||
self.addParameter(ParameterExtent(self.EXTENT,
|
self.addParameter(ParameterExtent(self.EXTENT,
|
||||||
self.tr('Grid extent')))
|
self.tr('Grid extent'), optional=False))
|
||||||
self.addParameter(ParameterNumber(self.STEP_X,
|
self.addParameter(ParameterNumber(self.STEP_X,
|
||||||
self.tr('X spacing'), 0.0, 1000000000.0, 0.0001))
|
self.tr('X spacing'), 0.0, 1000000000.0, 0.0001))
|
||||||
self.addParameter(ParameterNumber(self.STEP_Y,
|
self.addParameter(ParameterNumber(self.STEP_Y,
|
||||||
|
@ -50,6 +50,11 @@ class VectorGridPolygons(GeoAlgorithm):
|
|||||||
STEP_Y = 'STEP_Y'
|
STEP_Y = 'STEP_Y'
|
||||||
OUTPUT = 'OUTPUT'
|
OUTPUT = 'OUTPUT'
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
GeoAlgorithm.__init__(self)
|
||||||
|
# this algorithm is deprecated - use GridPolygon instead
|
||||||
|
self.showInToolbox = False
|
||||||
|
|
||||||
def getIcon(self):
|
def getIcon(self):
|
||||||
return QIcon(os.path.join(pluginPath, 'images', 'ftools', 'vector_grid.png'))
|
return QIcon(os.path.join(pluginPath, 'images', 'ftools', 'vector_grid.png'))
|
||||||
|
|
||||||
|
41
python/plugins/processing/tests/testdata/expected/grid_diamond.gfs
vendored
Normal file
41
python/plugins/processing/tests/testdata/expected/grid_diamond.gfs
vendored
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
<GMLFeatureClassList>
|
||||||
|
<GMLFeatureClass>
|
||||||
|
<Name>grid_diamond</Name>
|
||||||
|
<ElementPath>grid_diamond</ElementPath>
|
||||||
|
<!--POLYGON-->
|
||||||
|
<GeometryType>3</GeometryType>
|
||||||
|
<SRSName>EPSG:4326</SRSName>
|
||||||
|
<DatasetSpecificInfo>
|
||||||
|
<FeatureCount>20</FeatureCount>
|
||||||
|
<ExtentXMin>-1.00000</ExtentXMin>
|
||||||
|
<ExtentXMax>14.00000</ExtentXMax>
|
||||||
|
<ExtentYMin>-7.00000</ExtentYMin>
|
||||||
|
<ExtentYMax>6.50000</ExtentYMax>
|
||||||
|
</DatasetSpecificInfo>
|
||||||
|
<PropertyDefn>
|
||||||
|
<Name>left</Name>
|
||||||
|
<ElementPath>left</ElementPath>
|
||||||
|
<Type>Real</Type>
|
||||||
|
</PropertyDefn>
|
||||||
|
<PropertyDefn>
|
||||||
|
<Name>top</Name>
|
||||||
|
<ElementPath>top</ElementPath>
|
||||||
|
<Type>Real</Type>
|
||||||
|
</PropertyDefn>
|
||||||
|
<PropertyDefn>
|
||||||
|
<Name>right</Name>
|
||||||
|
<ElementPath>right</ElementPath>
|
||||||
|
<Type>Real</Type>
|
||||||
|
</PropertyDefn>
|
||||||
|
<PropertyDefn>
|
||||||
|
<Name>bottom</Name>
|
||||||
|
<ElementPath>bottom</ElementPath>
|
||||||
|
<Type>Real</Type>
|
||||||
|
</PropertyDefn>
|
||||||
|
<PropertyDefn>
|
||||||
|
<Name>id</Name>
|
||||||
|
<ElementPath>id</ElementPath>
|
||||||
|
<Type>Integer</Type>
|
||||||
|
</PropertyDefn>
|
||||||
|
</GMLFeatureClass>
|
||||||
|
</GMLFeatureClassList>
|
214
python/plugins/processing/tests/testdata/expected/grid_diamond.gml
vendored
Normal file
214
python/plugins/processing/tests/testdata/expected/grid_diamond.gml
vendored
Normal file
@ -0,0 +1,214 @@
|
|||||||
|
<?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>-1</gml:X><gml:Y>-7</gml:Y></gml:coord>
|
||||||
|
<gml:coord><gml:X>14</gml:X><gml:Y>6.5</gml:Y></gml:coord>
|
||||||
|
</gml:Box>
|
||||||
|
</gml:boundedBy>
|
||||||
|
|
||||||
|
<gml:featureMember>
|
||||||
|
<ogr:grid_diamond fid="grid_diamond.0">
|
||||||
|
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-1,5 1.5,6.5 4,5 1.5,3.5 -1,5</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
|
||||||
|
<ogr:left>-1.0000000000000000</ogr:left>
|
||||||
|
<ogr:top>6.5000000000000000</ogr:top>
|
||||||
|
<ogr:right>4.0000000000000000</ogr:right>
|
||||||
|
<ogr:bottom>3.5000000000000000</ogr:bottom>
|
||||||
|
<ogr:id>1</ogr:id>
|
||||||
|
</ogr:grid_diamond>
|
||||||
|
</gml:featureMember>
|
||||||
|
<gml:featureMember>
|
||||||
|
<ogr:grid_diamond fid="grid_diamond.1">
|
||||||
|
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-1,2 1.5,3.5 4,2 1.5,0.5 -1,2</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
|
||||||
|
<ogr:left>-1.0000000000000000</ogr:left>
|
||||||
|
<ogr:top>3.5000000000000000</ogr:top>
|
||||||
|
<ogr:right>4.0000000000000000</ogr:right>
|
||||||
|
<ogr:bottom>0.5000000000000000</ogr:bottom>
|
||||||
|
<ogr:id>2</ogr:id>
|
||||||
|
</ogr:grid_diamond>
|
||||||
|
</gml:featureMember>
|
||||||
|
<gml:featureMember>
|
||||||
|
<ogr:grid_diamond fid="grid_diamond.2">
|
||||||
|
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-1,-1 1.5,0.5 4,-1 1.5,-2.5 -1,-1</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
|
||||||
|
<ogr:left>-1.0000000000000000</ogr:left>
|
||||||
|
<ogr:top>0.5000000000000000</ogr:top>
|
||||||
|
<ogr:right>4.0000000000000000</ogr:right>
|
||||||
|
<ogr:bottom>-2.5000000000000000</ogr:bottom>
|
||||||
|
<ogr:id>3</ogr:id>
|
||||||
|
</ogr:grid_diamond>
|
||||||
|
</gml:featureMember>
|
||||||
|
<gml:featureMember>
|
||||||
|
<ogr:grid_diamond fid="grid_diamond.3">
|
||||||
|
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-1,-4 1.5,-2.5 4,-4 1.5,-5.5 -1,-4</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
|
||||||
|
<ogr:left>-1.0000000000000000</ogr:left>
|
||||||
|
<ogr:top>-2.5000000000000000</ogr:top>
|
||||||
|
<ogr:right>4.0000000000000000</ogr:right>
|
||||||
|
<ogr:bottom>-5.5000000000000000</ogr:bottom>
|
||||||
|
<ogr:id>4</ogr:id>
|
||||||
|
</ogr:grid_diamond>
|
||||||
|
</gml:featureMember>
|
||||||
|
<gml:featureMember>
|
||||||
|
<ogr:grid_diamond fid="grid_diamond.4">
|
||||||
|
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>1.5,3.5 4,5 6.5,3.5 4,2 1.5,3.5</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
|
||||||
|
<ogr:left>1.5000000000000000</ogr:left>
|
||||||
|
<ogr:top>5.0000000000000000</ogr:top>
|
||||||
|
<ogr:right>6.5000000000000000</ogr:right>
|
||||||
|
<ogr:bottom>2.0000000000000000</ogr:bottom>
|
||||||
|
<ogr:id>5</ogr:id>
|
||||||
|
</ogr:grid_diamond>
|
||||||
|
</gml:featureMember>
|
||||||
|
<gml:featureMember>
|
||||||
|
<ogr:grid_diamond fid="grid_diamond.5">
|
||||||
|
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>1.5,0.5 4,2 6.5,0.5 4,-1 1.5,0.5</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
|
||||||
|
<ogr:left>1.5000000000000000</ogr:left>
|
||||||
|
<ogr:top>2.0000000000000000</ogr:top>
|
||||||
|
<ogr:right>6.5000000000000000</ogr:right>
|
||||||
|
<ogr:bottom>-1.0000000000000000</ogr:bottom>
|
||||||
|
<ogr:id>6</ogr:id>
|
||||||
|
</ogr:grid_diamond>
|
||||||
|
</gml:featureMember>
|
||||||
|
<gml:featureMember>
|
||||||
|
<ogr:grid_diamond fid="grid_diamond.6">
|
||||||
|
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>1.5,-2.5 4,-1 6.5,-2.5 4,-4 1.5,-2.5</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
|
||||||
|
<ogr:left>1.5000000000000000</ogr:left>
|
||||||
|
<ogr:top>-1.0000000000000000</ogr:top>
|
||||||
|
<ogr:right>6.5000000000000000</ogr:right>
|
||||||
|
<ogr:bottom>-4.0000000000000000</ogr:bottom>
|
||||||
|
<ogr:id>7</ogr:id>
|
||||||
|
</ogr:grid_diamond>
|
||||||
|
</gml:featureMember>
|
||||||
|
<gml:featureMember>
|
||||||
|
<ogr:grid_diamond fid="grid_diamond.7">
|
||||||
|
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>1.5,-5.5 4,-4 6.5,-5.5 4,-7 1.5,-5.5</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
|
||||||
|
<ogr:left>1.5000000000000000</ogr:left>
|
||||||
|
<ogr:top>-4.0000000000000000</ogr:top>
|
||||||
|
<ogr:right>6.5000000000000000</ogr:right>
|
||||||
|
<ogr:bottom>-7.0000000000000000</ogr:bottom>
|
||||||
|
<ogr:id>8</ogr:id>
|
||||||
|
</ogr:grid_diamond>
|
||||||
|
</gml:featureMember>
|
||||||
|
<gml:featureMember>
|
||||||
|
<ogr:grid_diamond fid="grid_diamond.8">
|
||||||
|
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>4,5 6.5,6.5 9,5 6.5,3.5 4,5</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
|
||||||
|
<ogr:left>4.0000000000000000</ogr:left>
|
||||||
|
<ogr:top>6.5000000000000000</ogr:top>
|
||||||
|
<ogr:right>9.0000000000000000</ogr:right>
|
||||||
|
<ogr:bottom>3.5000000000000000</ogr:bottom>
|
||||||
|
<ogr:id>9</ogr:id>
|
||||||
|
</ogr:grid_diamond>
|
||||||
|
</gml:featureMember>
|
||||||
|
<gml:featureMember>
|
||||||
|
<ogr:grid_diamond fid="grid_diamond.9">
|
||||||
|
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>4,2 6.5,3.5 9,2 6.5,0.5 4,2</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
|
||||||
|
<ogr:left>4.0000000000000000</ogr:left>
|
||||||
|
<ogr:top>3.5000000000000000</ogr:top>
|
||||||
|
<ogr:right>9.0000000000000000</ogr:right>
|
||||||
|
<ogr:bottom>0.5000000000000000</ogr:bottom>
|
||||||
|
<ogr:id>10</ogr:id>
|
||||||
|
</ogr:grid_diamond>
|
||||||
|
</gml:featureMember>
|
||||||
|
<gml:featureMember>
|
||||||
|
<ogr:grid_diamond fid="grid_diamond.10">
|
||||||
|
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>4,-1 6.5,0.5 9,-1 6.5,-2.5 4,-1</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
|
||||||
|
<ogr:left>4.0000000000000000</ogr:left>
|
||||||
|
<ogr:top>0.5000000000000000</ogr:top>
|
||||||
|
<ogr:right>9.0000000000000000</ogr:right>
|
||||||
|
<ogr:bottom>-2.5000000000000000</ogr:bottom>
|
||||||
|
<ogr:id>11</ogr:id>
|
||||||
|
</ogr:grid_diamond>
|
||||||
|
</gml:featureMember>
|
||||||
|
<gml:featureMember>
|
||||||
|
<ogr:grid_diamond fid="grid_diamond.11">
|
||||||
|
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>4,-4 6.5,-2.5 9,-4 6.5,-5.5 4,-4</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
|
||||||
|
<ogr:left>4.0000000000000000</ogr:left>
|
||||||
|
<ogr:top>-2.5000000000000000</ogr:top>
|
||||||
|
<ogr:right>9.0000000000000000</ogr:right>
|
||||||
|
<ogr:bottom>-5.5000000000000000</ogr:bottom>
|
||||||
|
<ogr:id>12</ogr:id>
|
||||||
|
</ogr:grid_diamond>
|
||||||
|
</gml:featureMember>
|
||||||
|
<gml:featureMember>
|
||||||
|
<ogr:grid_diamond fid="grid_diamond.12">
|
||||||
|
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>6.5,3.5 9,5 11.5,3.5 9,2 6.5,3.5</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
|
||||||
|
<ogr:left>6.5000000000000000</ogr:left>
|
||||||
|
<ogr:top>5.0000000000000000</ogr:top>
|
||||||
|
<ogr:right>11.5000000000000000</ogr:right>
|
||||||
|
<ogr:bottom>2.0000000000000000</ogr:bottom>
|
||||||
|
<ogr:id>13</ogr:id>
|
||||||
|
</ogr:grid_diamond>
|
||||||
|
</gml:featureMember>
|
||||||
|
<gml:featureMember>
|
||||||
|
<ogr:grid_diamond fid="grid_diamond.13">
|
||||||
|
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>6.5,0.5 9,2 11.5,0.5 9,-1 6.5,0.5</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
|
||||||
|
<ogr:left>6.5000000000000000</ogr:left>
|
||||||
|
<ogr:top>2.0000000000000000</ogr:top>
|
||||||
|
<ogr:right>11.5000000000000000</ogr:right>
|
||||||
|
<ogr:bottom>-1.0000000000000000</ogr:bottom>
|
||||||
|
<ogr:id>14</ogr:id>
|
||||||
|
</ogr:grid_diamond>
|
||||||
|
</gml:featureMember>
|
||||||
|
<gml:featureMember>
|
||||||
|
<ogr:grid_diamond fid="grid_diamond.14">
|
||||||
|
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>6.5,-2.5 9,-1 11.5,-2.5 9,-4 6.5,-2.5</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
|
||||||
|
<ogr:left>6.5000000000000000</ogr:left>
|
||||||
|
<ogr:top>-1.0000000000000000</ogr:top>
|
||||||
|
<ogr:right>11.5000000000000000</ogr:right>
|
||||||
|
<ogr:bottom>-4.0000000000000000</ogr:bottom>
|
||||||
|
<ogr:id>15</ogr:id>
|
||||||
|
</ogr:grid_diamond>
|
||||||
|
</gml:featureMember>
|
||||||
|
<gml:featureMember>
|
||||||
|
<ogr:grid_diamond fid="grid_diamond.15">
|
||||||
|
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>6.5,-5.5 9,-4 11.5,-5.5 9,-7 6.5,-5.5</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
|
||||||
|
<ogr:left>6.5000000000000000</ogr:left>
|
||||||
|
<ogr:top>-4.0000000000000000</ogr:top>
|
||||||
|
<ogr:right>11.5000000000000000</ogr:right>
|
||||||
|
<ogr:bottom>-7.0000000000000000</ogr:bottom>
|
||||||
|
<ogr:id>16</ogr:id>
|
||||||
|
</ogr:grid_diamond>
|
||||||
|
</gml:featureMember>
|
||||||
|
<gml:featureMember>
|
||||||
|
<ogr:grid_diamond fid="grid_diamond.16">
|
||||||
|
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>9,5 11.5,6.5 14,5 11.5,3.5 9,5</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
|
||||||
|
<ogr:left>9.0000000000000000</ogr:left>
|
||||||
|
<ogr:top>6.5000000000000000</ogr:top>
|
||||||
|
<ogr:right>14.0000000000000000</ogr:right>
|
||||||
|
<ogr:bottom>3.5000000000000000</ogr:bottom>
|
||||||
|
<ogr:id>17</ogr:id>
|
||||||
|
</ogr:grid_diamond>
|
||||||
|
</gml:featureMember>
|
||||||
|
<gml:featureMember>
|
||||||
|
<ogr:grid_diamond fid="grid_diamond.17">
|
||||||
|
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>9,2 11.5,3.5 14,2 11.5,0.5 9,2</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
|
||||||
|
<ogr:left>9.0000000000000000</ogr:left>
|
||||||
|
<ogr:top>3.5000000000000000</ogr:top>
|
||||||
|
<ogr:right>14.0000000000000000</ogr:right>
|
||||||
|
<ogr:bottom>0.5000000000000000</ogr:bottom>
|
||||||
|
<ogr:id>18</ogr:id>
|
||||||
|
</ogr:grid_diamond>
|
||||||
|
</gml:featureMember>
|
||||||
|
<gml:featureMember>
|
||||||
|
<ogr:grid_diamond fid="grid_diamond.18">
|
||||||
|
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>9,-1 11.5,0.5 14,-1 11.5,-2.5 9,-1</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
|
||||||
|
<ogr:left>9.0000000000000000</ogr:left>
|
||||||
|
<ogr:top>0.5000000000000000</ogr:top>
|
||||||
|
<ogr:right>14.0000000000000000</ogr:right>
|
||||||
|
<ogr:bottom>-2.5000000000000000</ogr:bottom>
|
||||||
|
<ogr:id>19</ogr:id>
|
||||||
|
</ogr:grid_diamond>
|
||||||
|
</gml:featureMember>
|
||||||
|
<gml:featureMember>
|
||||||
|
<ogr:grid_diamond fid="grid_diamond.19">
|
||||||
|
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>9,-4 11.5,-2.5 14,-4 11.5,-5.5 9,-4</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
|
||||||
|
<ogr:left>9.0000000000000000</ogr:left>
|
||||||
|
<ogr:top>-2.5000000000000000</ogr:top>
|
||||||
|
<ogr:right>14.0000000000000000</ogr:right>
|
||||||
|
<ogr:bottom>-5.5000000000000000</ogr:bottom>
|
||||||
|
<ogr:id>20</ogr:id>
|
||||||
|
</ogr:grid_diamond>
|
||||||
|
</gml:featureMember>
|
||||||
|
</ogr:FeatureCollection>
|
41
python/plugins/processing/tests/testdata/expected/grid_hexagon.gfs
vendored
Normal file
41
python/plugins/processing/tests/testdata/expected/grid_hexagon.gfs
vendored
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
<GMLFeatureClassList>
|
||||||
|
<GMLFeatureClass>
|
||||||
|
<Name>grid_hexagon</Name>
|
||||||
|
<ElementPath>grid_hexagon</ElementPath>
|
||||||
|
<!--POLYGON-->
|
||||||
|
<GeometryType>3</GeometryType>
|
||||||
|
<SRSName>EPSG:4326</SRSName>
|
||||||
|
<DatasetSpecificInfo>
|
||||||
|
<FeatureCount>9</FeatureCount>
|
||||||
|
<ExtentXMin>-1.00000</ExtentXMin>
|
||||||
|
<ExtentXMax>13.43376</ExtentXMax>
|
||||||
|
<ExtentYMin>-11.00000</ExtentYMin>
|
||||||
|
<ExtentYMax>6.50000</ExtentYMax>
|
||||||
|
</DatasetSpecificInfo>
|
||||||
|
<PropertyDefn>
|
||||||
|
<Name>left</Name>
|
||||||
|
<ElementPath>left</ElementPath>
|
||||||
|
<Type>Real</Type>
|
||||||
|
</PropertyDefn>
|
||||||
|
<PropertyDefn>
|
||||||
|
<Name>top</Name>
|
||||||
|
<ElementPath>top</ElementPath>
|
||||||
|
<Type>Real</Type>
|
||||||
|
</PropertyDefn>
|
||||||
|
<PropertyDefn>
|
||||||
|
<Name>right</Name>
|
||||||
|
<ElementPath>right</ElementPath>
|
||||||
|
<Type>Real</Type>
|
||||||
|
</PropertyDefn>
|
||||||
|
<PropertyDefn>
|
||||||
|
<Name>bottom</Name>
|
||||||
|
<ElementPath>bottom</ElementPath>
|
||||||
|
<Type>Real</Type>
|
||||||
|
</PropertyDefn>
|
||||||
|
<PropertyDefn>
|
||||||
|
<Name>id</Name>
|
||||||
|
<ElementPath>id</ElementPath>
|
||||||
|
<Type>Integer</Type>
|
||||||
|
</PropertyDefn>
|
||||||
|
</GMLFeatureClass>
|
||||||
|
</GMLFeatureClassList>
|
104
python/plugins/processing/tests/testdata/expected/grid_hexagon.gml
vendored
Normal file
104
python/plugins/processing/tests/testdata/expected/grid_hexagon.gml
vendored
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
<?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>-1</gml:X><gml:Y>-11</gml:Y></gml:coord>
|
||||||
|
<gml:coord><gml:X>13.43375672974065</gml:X><gml:Y>6.5</gml:Y></gml:coord>
|
||||||
|
</gml:Box>
|
||||||
|
</gml:boundedBy>
|
||||||
|
|
||||||
|
<gml:featureMember>
|
||||||
|
<ogr:grid_hexagon fid="grid_hexagon.0">
|
||||||
|
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-1,4 0.443375672974065,6.5 3.33012701892219,6.5 4.77350269189626,4.0 3.33012701892219,1.5 0.443375672974065,1.5 -1,4</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
|
||||||
|
<ogr:left>-1.0000000000000000</ogr:left>
|
||||||
|
<ogr:top>6.5000000000000000</ogr:top>
|
||||||
|
<ogr:right>4.7735026918962600</ogr:right>
|
||||||
|
<ogr:bottom>1.5000000000000000</ogr:bottom>
|
||||||
|
<ogr:id>1</ogr:id>
|
||||||
|
</ogr:grid_hexagon>
|
||||||
|
</gml:featureMember>
|
||||||
|
<gml:featureMember>
|
||||||
|
<ogr:grid_hexagon fid="grid_hexagon.1">
|
||||||
|
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-1,-1 0.443375672974065,1.5 3.33012701892219,1.5 4.77350269189626,-1.0 3.33012701892219,-3.5 0.443375672974065,-3.5 -1,-1</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
|
||||||
|
<ogr:left>-1.0000000000000000</ogr:left>
|
||||||
|
<ogr:top>1.5000000000000000</ogr:top>
|
||||||
|
<ogr:right>4.7735026918962600</ogr:right>
|
||||||
|
<ogr:bottom>-3.5000000000000000</ogr:bottom>
|
||||||
|
<ogr:id>2</ogr:id>
|
||||||
|
</ogr:grid_hexagon>
|
||||||
|
</gml:featureMember>
|
||||||
|
<gml:featureMember>
|
||||||
|
<ogr:grid_hexagon fid="grid_hexagon.2">
|
||||||
|
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-1,-6 0.443375672974065,-3.5 3.33012701892219,-3.5 4.77350269189626,-6.0 3.33012701892219,-8.5 0.443375672974065,-8.5 -1,-6</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
|
||||||
|
<ogr:left>-1.0000000000000000</ogr:left>
|
||||||
|
<ogr:top>-3.5000000000000000</ogr:top>
|
||||||
|
<ogr:right>4.7735026918962600</ogr:right>
|
||||||
|
<ogr:bottom>-8.5000000000000000</ogr:bottom>
|
||||||
|
<ogr:id>3</ogr:id>
|
||||||
|
</ogr:grid_hexagon>
|
||||||
|
</gml:featureMember>
|
||||||
|
<gml:featureMember>
|
||||||
|
<ogr:grid_hexagon fid="grid_hexagon.3">
|
||||||
|
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>3.33012701892219,1.5 4.77350269189626,4.0 7.66025403784439,4.0 9.10362971081845,1.5 7.66025403784439,-1.0 4.77350269189626,-1.0 3.33012701892219,1.5</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
|
||||||
|
<ogr:left>3.3301270189221945</ogr:left>
|
||||||
|
<ogr:top>4.0000000000000000</ogr:top>
|
||||||
|
<ogr:right>9.1036297108184545</ogr:right>
|
||||||
|
<ogr:bottom>-1.0000000000000000</ogr:bottom>
|
||||||
|
<ogr:id>4</ogr:id>
|
||||||
|
</ogr:grid_hexagon>
|
||||||
|
</gml:featureMember>
|
||||||
|
<gml:featureMember>
|
||||||
|
<ogr:grid_hexagon fid="grid_hexagon.4">
|
||||||
|
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>3.33012701892219,-3.5 4.77350269189626,-1.0 7.66025403784439,-1.0 9.10362971081845,-3.5 7.66025403784439,-6.0 4.77350269189626,-6.0 3.33012701892219,-3.5</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
|
||||||
|
<ogr:left>3.3301270189221945</ogr:left>
|
||||||
|
<ogr:top>-1.0000000000000000</ogr:top>
|
||||||
|
<ogr:right>9.1036297108184545</ogr:right>
|
||||||
|
<ogr:bottom>-6.0000000000000000</ogr:bottom>
|
||||||
|
<ogr:id>5</ogr:id>
|
||||||
|
</ogr:grid_hexagon>
|
||||||
|
</gml:featureMember>
|
||||||
|
<gml:featureMember>
|
||||||
|
<ogr:grid_hexagon fid="grid_hexagon.5">
|
||||||
|
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>3.33012701892219,-8.5 4.77350269189626,-6.0 7.66025403784439,-6.0 9.10362971081845,-8.5 7.66025403784439,-11.0 4.77350269189626,-11.0 3.33012701892219,-8.5</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
|
||||||
|
<ogr:left>3.3301270189221945</ogr:left>
|
||||||
|
<ogr:top>-6.0000000000000000</ogr:top>
|
||||||
|
<ogr:right>9.1036297108184545</ogr:right>
|
||||||
|
<ogr:bottom>-11.0000000000000000</ogr:bottom>
|
||||||
|
<ogr:id>6</ogr:id>
|
||||||
|
</ogr:grid_hexagon>
|
||||||
|
</gml:featureMember>
|
||||||
|
<gml:featureMember>
|
||||||
|
<ogr:grid_hexagon fid="grid_hexagon.6">
|
||||||
|
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>7.66025403784439,4.0 9.10362971081845,6.5 11.9903810567666,6.5 13.4337567297406,4.0 11.9903810567666,1.5 9.10362971081845,1.5 7.66025403784439,4.0</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
|
||||||
|
<ogr:left>7.6602540378443891</ogr:left>
|
||||||
|
<ogr:top>6.5000000000000000</ogr:top>
|
||||||
|
<ogr:right>13.4337567297406490</ogr:right>
|
||||||
|
<ogr:bottom>1.5000000000000000</ogr:bottom>
|
||||||
|
<ogr:id>7</ogr:id>
|
||||||
|
</ogr:grid_hexagon>
|
||||||
|
</gml:featureMember>
|
||||||
|
<gml:featureMember>
|
||||||
|
<ogr:grid_hexagon fid="grid_hexagon.7">
|
||||||
|
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>7.66025403784439,-1.0 9.10362971081845,1.5 11.9903810567666,1.5 13.4337567297406,-1.0 11.9903810567666,-3.5 9.10362971081845,-3.5 7.66025403784439,-1.0</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
|
||||||
|
<ogr:left>7.6602540378443891</ogr:left>
|
||||||
|
<ogr:top>1.5000000000000000</ogr:top>
|
||||||
|
<ogr:right>13.4337567297406490</ogr:right>
|
||||||
|
<ogr:bottom>-3.5000000000000000</ogr:bottom>
|
||||||
|
<ogr:id>8</ogr:id>
|
||||||
|
</ogr:grid_hexagon>
|
||||||
|
</gml:featureMember>
|
||||||
|
<gml:featureMember>
|
||||||
|
<ogr:grid_hexagon fid="grid_hexagon.8">
|
||||||
|
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>7.66025403784439,-6.0 9.10362971081845,-3.5 11.9903810567666,-3.5 13.4337567297406,-6.0 11.9903810567666,-8.5 9.10362971081845,-8.5 7.66025403784439,-6.0</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
|
||||||
|
<ogr:left>7.6602540378443891</ogr:left>
|
||||||
|
<ogr:top>-3.5000000000000000</ogr:top>
|
||||||
|
<ogr:right>13.4337567297406490</ogr:right>
|
||||||
|
<ogr:bottom>-8.5000000000000000</ogr:bottom>
|
||||||
|
<ogr:id>9</ogr:id>
|
||||||
|
</ogr:grid_hexagon>
|
||||||
|
</gml:featureMember>
|
||||||
|
</ogr:FeatureCollection>
|
46
python/plugins/processing/tests/testdata/expected/grid_lines.gfs
vendored
Normal file
46
python/plugins/processing/tests/testdata/expected/grid_lines.gfs
vendored
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<GMLFeatureClassList>
|
||||||
|
<GMLFeatureClass>
|
||||||
|
<Name>grid_lines</Name>
|
||||||
|
<ElementPath>grid_lines</ElementPath>
|
||||||
|
<!--LINESTRING-->
|
||||||
|
<GeometryType>2</GeometryType>
|
||||||
|
<SRSName>EPSG:4326</SRSName>
|
||||||
|
<DatasetSpecificInfo>
|
||||||
|
<FeatureCount>7</FeatureCount>
|
||||||
|
<ExtentXMin>-1.00000</ExtentXMin>
|
||||||
|
<ExtentXMax>11.20000</ExtentXMax>
|
||||||
|
<ExtentYMin>-4.00000</ExtentYMin>
|
||||||
|
<ExtentYMax>6.50000</ExtentYMax>
|
||||||
|
</DatasetSpecificInfo>
|
||||||
|
<PropertyDefn>
|
||||||
|
<Name>left</Name>
|
||||||
|
<ElementPath>left</ElementPath>
|
||||||
|
<Type>Real</Type>
|
||||||
|
</PropertyDefn>
|
||||||
|
<PropertyDefn>
|
||||||
|
<Name>top</Name>
|
||||||
|
<ElementPath>top</ElementPath>
|
||||||
|
<Type>Real</Type>
|
||||||
|
</PropertyDefn>
|
||||||
|
<PropertyDefn>
|
||||||
|
<Name>right</Name>
|
||||||
|
<ElementPath>right</ElementPath>
|
||||||
|
<Type>Real</Type>
|
||||||
|
</PropertyDefn>
|
||||||
|
<PropertyDefn>
|
||||||
|
<Name>bottom</Name>
|
||||||
|
<ElementPath>bottom</ElementPath>
|
||||||
|
<Type>Real</Type>
|
||||||
|
</PropertyDefn>
|
||||||
|
<PropertyDefn>
|
||||||
|
<Name>id</Name>
|
||||||
|
<ElementPath>id</ElementPath>
|
||||||
|
<Type>Integer</Type>
|
||||||
|
</PropertyDefn>
|
||||||
|
<PropertyDefn>
|
||||||
|
<Name>coord</Name>
|
||||||
|
<ElementPath>coord</ElementPath>
|
||||||
|
<Type>Real</Type>
|
||||||
|
</PropertyDefn>
|
||||||
|
</GMLFeatureClass>
|
||||||
|
</GMLFeatureClassList>
|
91
python/plugins/processing/tests/testdata/expected/grid_lines.gml
vendored
Normal file
91
python/plugins/processing/tests/testdata/expected/grid_lines.gml
vendored
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
<?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>-1</gml:X><gml:Y>-4</gml:Y></gml:coord>
|
||||||
|
<gml:coord><gml:X>11.2</gml:X><gml:Y>6.5</gml:Y></gml:coord>
|
||||||
|
</gml:Box>
|
||||||
|
</gml:boundedBy>
|
||||||
|
|
||||||
|
<gml:featureMember>
|
||||||
|
<ogr:grid_lines fid="grid_lines.0">
|
||||||
|
<ogr:geometryProperty><gml:LineString srsName="EPSG:4326"><gml:coordinates>-1.0,6.5 11.2,6.5</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||||
|
<ogr:left>-1.0000000000000000</ogr:left>
|
||||||
|
<ogr:top>6.5000000000000000</ogr:top>
|
||||||
|
<ogr:right>11.1999999999999993</ogr:right>
|
||||||
|
<ogr:bottom>6.5000000000000000</ogr:bottom>
|
||||||
|
<ogr:id>1</ogr:id>
|
||||||
|
<ogr:coord>6.500000000000000</ogr:coord>
|
||||||
|
</ogr:grid_lines>
|
||||||
|
</gml:featureMember>
|
||||||
|
<gml:featureMember>
|
||||||
|
<ogr:grid_lines fid="grid_lines.1">
|
||||||
|
<ogr:geometryProperty><gml:LineString srsName="EPSG:4326"><gml:coordinates>-1.0,3.5 11.2,3.5</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||||
|
<ogr:left>-1.0000000000000000</ogr:left>
|
||||||
|
<ogr:top>3.5000000000000000</ogr:top>
|
||||||
|
<ogr:right>11.1999999999999993</ogr:right>
|
||||||
|
<ogr:bottom>3.5000000000000000</ogr:bottom>
|
||||||
|
<ogr:id>2</ogr:id>
|
||||||
|
<ogr:coord>3.500000000000000</ogr:coord>
|
||||||
|
</ogr:grid_lines>
|
||||||
|
</gml:featureMember>
|
||||||
|
<gml:featureMember>
|
||||||
|
<ogr:grid_lines fid="grid_lines.2">
|
||||||
|
<ogr:geometryProperty><gml:LineString srsName="EPSG:4326"><gml:coordinates>-1.0,0.5 11.2,0.5</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||||
|
<ogr:left>-1.0000000000000000</ogr:left>
|
||||||
|
<ogr:top>0.5000000000000000</ogr:top>
|
||||||
|
<ogr:right>11.1999999999999993</ogr:right>
|
||||||
|
<ogr:bottom>0.5000000000000000</ogr:bottom>
|
||||||
|
<ogr:id>3</ogr:id>
|
||||||
|
<ogr:coord>0.500000000000000</ogr:coord>
|
||||||
|
</ogr:grid_lines>
|
||||||
|
</gml:featureMember>
|
||||||
|
<gml:featureMember>
|
||||||
|
<ogr:grid_lines fid="grid_lines.3">
|
||||||
|
<ogr:geometryProperty><gml:LineString srsName="EPSG:4326"><gml:coordinates>-1.0,-2.5 11.2,-2.5</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||||
|
<ogr:left>-1.0000000000000000</ogr:left>
|
||||||
|
<ogr:top>-2.5000000000000000</ogr:top>
|
||||||
|
<ogr:right>11.1999999999999993</ogr:right>
|
||||||
|
<ogr:bottom>-2.5000000000000000</ogr:bottom>
|
||||||
|
<ogr:id>4</ogr:id>
|
||||||
|
<ogr:coord>-2.500000000000000</ogr:coord>
|
||||||
|
</ogr:grid_lines>
|
||||||
|
</gml:featureMember>
|
||||||
|
<gml:featureMember>
|
||||||
|
<ogr:grid_lines fid="grid_lines.4">
|
||||||
|
<ogr:geometryProperty><gml:LineString srsName="EPSG:4326"><gml:coordinates>-1.0,6.5 -1,-4</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||||
|
<ogr:left>-1.0000000000000000</ogr:left>
|
||||||
|
<ogr:top>6.5000000000000000</ogr:top>
|
||||||
|
<ogr:right>-1.0000000000000000</ogr:right>
|
||||||
|
<ogr:bottom>-4.0000000000000000</ogr:bottom>
|
||||||
|
<ogr:id>5</ogr:id>
|
||||||
|
<ogr:coord>-1.000000000000000</ogr:coord>
|
||||||
|
</ogr:grid_lines>
|
||||||
|
</gml:featureMember>
|
||||||
|
<gml:featureMember>
|
||||||
|
<ogr:grid_lines fid="grid_lines.5">
|
||||||
|
<ogr:geometryProperty><gml:LineString srsName="EPSG:4326"><gml:coordinates>4.0,6.5 4,-4</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||||
|
<ogr:left>4.0000000000000000</ogr:left>
|
||||||
|
<ogr:top>6.5000000000000000</ogr:top>
|
||||||
|
<ogr:right>4.0000000000000000</ogr:right>
|
||||||
|
<ogr:bottom>-4.0000000000000000</ogr:bottom>
|
||||||
|
<ogr:id>6</ogr:id>
|
||||||
|
<ogr:coord>4.000000000000000</ogr:coord>
|
||||||
|
</ogr:grid_lines>
|
||||||
|
</gml:featureMember>
|
||||||
|
<gml:featureMember>
|
||||||
|
<ogr:grid_lines fid="grid_lines.6">
|
||||||
|
<ogr:geometryProperty><gml:LineString srsName="EPSG:4326"><gml:coordinates>9.0,6.5 9,-4</gml:coordinates></gml:LineString></ogr:geometryProperty>
|
||||||
|
<ogr:left>9.0000000000000000</ogr:left>
|
||||||
|
<ogr:top>6.5000000000000000</ogr:top>
|
||||||
|
<ogr:right>9.0000000000000000</ogr:right>
|
||||||
|
<ogr:bottom>-4.0000000000000000</ogr:bottom>
|
||||||
|
<ogr:id>7</ogr:id>
|
||||||
|
<ogr:coord>9.000000000000000</ogr:coord>
|
||||||
|
</ogr:grid_lines>
|
||||||
|
</gml:featureMember>
|
||||||
|
</ogr:FeatureCollection>
|
41
python/plugins/processing/tests/testdata/expected/grid_rectangles.gfs
vendored
Normal file
41
python/plugins/processing/tests/testdata/expected/grid_rectangles.gfs
vendored
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
<GMLFeatureClassList>
|
||||||
|
<GMLFeatureClass>
|
||||||
|
<Name>grid_rectangles</Name>
|
||||||
|
<ElementPath>grid_rectangles</ElementPath>
|
||||||
|
<!--POLYGON-->
|
||||||
|
<GeometryType>3</GeometryType>
|
||||||
|
<SRSName>EPSG:4326</SRSName>
|
||||||
|
<DatasetSpecificInfo>
|
||||||
|
<FeatureCount>12</FeatureCount>
|
||||||
|
<ExtentXMin>-1.00000</ExtentXMin>
|
||||||
|
<ExtentXMax>14.00000</ExtentXMax>
|
||||||
|
<ExtentYMin>-5.50000</ExtentYMin>
|
||||||
|
<ExtentYMax>6.50000</ExtentYMax>
|
||||||
|
</DatasetSpecificInfo>
|
||||||
|
<PropertyDefn>
|
||||||
|
<Name>left</Name>
|
||||||
|
<ElementPath>left</ElementPath>
|
||||||
|
<Type>Real</Type>
|
||||||
|
</PropertyDefn>
|
||||||
|
<PropertyDefn>
|
||||||
|
<Name>top</Name>
|
||||||
|
<ElementPath>top</ElementPath>
|
||||||
|
<Type>Real</Type>
|
||||||
|
</PropertyDefn>
|
||||||
|
<PropertyDefn>
|
||||||
|
<Name>right</Name>
|
||||||
|
<ElementPath>right</ElementPath>
|
||||||
|
<Type>Real</Type>
|
||||||
|
</PropertyDefn>
|
||||||
|
<PropertyDefn>
|
||||||
|
<Name>bottom</Name>
|
||||||
|
<ElementPath>bottom</ElementPath>
|
||||||
|
<Type>Real</Type>
|
||||||
|
</PropertyDefn>
|
||||||
|
<PropertyDefn>
|
||||||
|
<Name>id</Name>
|
||||||
|
<ElementPath>id</ElementPath>
|
||||||
|
<Type>Integer</Type>
|
||||||
|
</PropertyDefn>
|
||||||
|
</GMLFeatureClass>
|
||||||
|
</GMLFeatureClassList>
|
134
python/plugins/processing/tests/testdata/expected/grid_rectangles.gml
vendored
Normal file
134
python/plugins/processing/tests/testdata/expected/grid_rectangles.gml
vendored
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
<?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>-1</gml:X><gml:Y>-5.5</gml:Y></gml:coord>
|
||||||
|
<gml:coord><gml:X>14</gml:X><gml:Y>6.5</gml:Y></gml:coord>
|
||||||
|
</gml:Box>
|
||||||
|
</gml:boundedBy>
|
||||||
|
|
||||||
|
<gml:featureMember>
|
||||||
|
<ogr:grid_rectangles fid="grid_rectangles.0">
|
||||||
|
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-1.0,6.5 4.0,6.5 4.0,3.5 -1.0,3.5 -1.0,6.5</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
|
||||||
|
<ogr:left>-1.0000000000000000</ogr:left>
|
||||||
|
<ogr:top>6.5000000000000000</ogr:top>
|
||||||
|
<ogr:right>4.0000000000000000</ogr:right>
|
||||||
|
<ogr:bottom>3.5000000000000000</ogr:bottom>
|
||||||
|
<ogr:id>1</ogr:id>
|
||||||
|
</ogr:grid_rectangles>
|
||||||
|
</gml:featureMember>
|
||||||
|
<gml:featureMember>
|
||||||
|
<ogr:grid_rectangles fid="grid_rectangles.1">
|
||||||
|
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-1.0,3.5 4.0,3.5 4.0,0.5 -1.0,0.5 -1.0,3.5</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
|
||||||
|
<ogr:left>-1.0000000000000000</ogr:left>
|
||||||
|
<ogr:top>3.5000000000000000</ogr:top>
|
||||||
|
<ogr:right>4.0000000000000000</ogr:right>
|
||||||
|
<ogr:bottom>0.5000000000000000</ogr:bottom>
|
||||||
|
<ogr:id>2</ogr:id>
|
||||||
|
</ogr:grid_rectangles>
|
||||||
|
</gml:featureMember>
|
||||||
|
<gml:featureMember>
|
||||||
|
<ogr:grid_rectangles fid="grid_rectangles.2">
|
||||||
|
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-1.0,0.5 4.0,0.5 4.0,-2.5 -1.0,-2.5 -1.0,0.5</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
|
||||||
|
<ogr:left>-1.0000000000000000</ogr:left>
|
||||||
|
<ogr:top>0.5000000000000000</ogr:top>
|
||||||
|
<ogr:right>4.0000000000000000</ogr:right>
|
||||||
|
<ogr:bottom>-2.5000000000000000</ogr:bottom>
|
||||||
|
<ogr:id>3</ogr:id>
|
||||||
|
</ogr:grid_rectangles>
|
||||||
|
</gml:featureMember>
|
||||||
|
<gml:featureMember>
|
||||||
|
<ogr:grid_rectangles fid="grid_rectangles.3">
|
||||||
|
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-1.0,-2.5 4.0,-2.5 4.0,-5.5 -1.0,-5.5 -1.0,-2.5</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
|
||||||
|
<ogr:left>-1.0000000000000000</ogr:left>
|
||||||
|
<ogr:top>-2.5000000000000000</ogr:top>
|
||||||
|
<ogr:right>4.0000000000000000</ogr:right>
|
||||||
|
<ogr:bottom>-5.5000000000000000</ogr:bottom>
|
||||||
|
<ogr:id>4</ogr:id>
|
||||||
|
</ogr:grid_rectangles>
|
||||||
|
</gml:featureMember>
|
||||||
|
<gml:featureMember>
|
||||||
|
<ogr:grid_rectangles fid="grid_rectangles.4">
|
||||||
|
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>4.0,6.5 9.0,6.5 9.0,3.5 4.0,3.5 4.0,6.5</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
|
||||||
|
<ogr:left>4.0000000000000000</ogr:left>
|
||||||
|
<ogr:top>6.5000000000000000</ogr:top>
|
||||||
|
<ogr:right>9.0000000000000000</ogr:right>
|
||||||
|
<ogr:bottom>3.5000000000000000</ogr:bottom>
|
||||||
|
<ogr:id>5</ogr:id>
|
||||||
|
</ogr:grid_rectangles>
|
||||||
|
</gml:featureMember>
|
||||||
|
<gml:featureMember>
|
||||||
|
<ogr:grid_rectangles fid="grid_rectangles.5">
|
||||||
|
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>4.0,3.5 9.0,3.5 9.0,0.5 4.0,0.5 4.0,3.5</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
|
||||||
|
<ogr:left>4.0000000000000000</ogr:left>
|
||||||
|
<ogr:top>3.5000000000000000</ogr:top>
|
||||||
|
<ogr:right>9.0000000000000000</ogr:right>
|
||||||
|
<ogr:bottom>0.5000000000000000</ogr:bottom>
|
||||||
|
<ogr:id>6</ogr:id>
|
||||||
|
</ogr:grid_rectangles>
|
||||||
|
</gml:featureMember>
|
||||||
|
<gml:featureMember>
|
||||||
|
<ogr:grid_rectangles fid="grid_rectangles.6">
|
||||||
|
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>4.0,0.5 9.0,0.5 9.0,-2.5 4.0,-2.5 4.0,0.5</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
|
||||||
|
<ogr:left>4.0000000000000000</ogr:left>
|
||||||
|
<ogr:top>0.5000000000000000</ogr:top>
|
||||||
|
<ogr:right>9.0000000000000000</ogr:right>
|
||||||
|
<ogr:bottom>-2.5000000000000000</ogr:bottom>
|
||||||
|
<ogr:id>7</ogr:id>
|
||||||
|
</ogr:grid_rectangles>
|
||||||
|
</gml:featureMember>
|
||||||
|
<gml:featureMember>
|
||||||
|
<ogr:grid_rectangles fid="grid_rectangles.7">
|
||||||
|
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>4.0,-2.5 9.0,-2.5 9.0,-5.5 4.0,-5.5 4.0,-2.5</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
|
||||||
|
<ogr:left>4.0000000000000000</ogr:left>
|
||||||
|
<ogr:top>-2.5000000000000000</ogr:top>
|
||||||
|
<ogr:right>9.0000000000000000</ogr:right>
|
||||||
|
<ogr:bottom>-5.5000000000000000</ogr:bottom>
|
||||||
|
<ogr:id>8</ogr:id>
|
||||||
|
</ogr:grid_rectangles>
|
||||||
|
</gml:featureMember>
|
||||||
|
<gml:featureMember>
|
||||||
|
<ogr:grid_rectangles fid="grid_rectangles.8">
|
||||||
|
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>9.0,6.5 14.0,6.5 14.0,3.5 9.0,3.5 9.0,6.5</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
|
||||||
|
<ogr:left>9.0000000000000000</ogr:left>
|
||||||
|
<ogr:top>6.5000000000000000</ogr:top>
|
||||||
|
<ogr:right>14.0000000000000000</ogr:right>
|
||||||
|
<ogr:bottom>3.5000000000000000</ogr:bottom>
|
||||||
|
<ogr:id>9</ogr:id>
|
||||||
|
</ogr:grid_rectangles>
|
||||||
|
</gml:featureMember>
|
||||||
|
<gml:featureMember>
|
||||||
|
<ogr:grid_rectangles fid="grid_rectangles.9">
|
||||||
|
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>9.0,3.5 14.0,3.5 14.0,0.5 9.0,0.5 9.0,3.5</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
|
||||||
|
<ogr:left>9.0000000000000000</ogr:left>
|
||||||
|
<ogr:top>3.5000000000000000</ogr:top>
|
||||||
|
<ogr:right>14.0000000000000000</ogr:right>
|
||||||
|
<ogr:bottom>0.5000000000000000</ogr:bottom>
|
||||||
|
<ogr:id>10</ogr:id>
|
||||||
|
</ogr:grid_rectangles>
|
||||||
|
</gml:featureMember>
|
||||||
|
<gml:featureMember>
|
||||||
|
<ogr:grid_rectangles fid="grid_rectangles.10">
|
||||||
|
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>9.0,0.5 14.0,0.5 14.0,-2.5 9.0,-2.5 9.0,0.5</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
|
||||||
|
<ogr:left>9.0000000000000000</ogr:left>
|
||||||
|
<ogr:top>0.5000000000000000</ogr:top>
|
||||||
|
<ogr:right>14.0000000000000000</ogr:right>
|
||||||
|
<ogr:bottom>-2.5000000000000000</ogr:bottom>
|
||||||
|
<ogr:id>11</ogr:id>
|
||||||
|
</ogr:grid_rectangles>
|
||||||
|
</gml:featureMember>
|
||||||
|
<gml:featureMember>
|
||||||
|
<ogr:grid_rectangles fid="grid_rectangles.11">
|
||||||
|
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>9.0,-2.5 14.0,-2.5 14.0,-5.5 9.0,-5.5 9.0,-2.5</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
|
||||||
|
<ogr:left>9.0000000000000000</ogr:left>
|
||||||
|
<ogr:top>-2.5000000000000000</ogr:top>
|
||||||
|
<ogr:right>14.0000000000000000</ogr:right>
|
||||||
|
<ogr:bottom>-5.5000000000000000</ogr:bottom>
|
||||||
|
<ogr:id>12</ogr:id>
|
||||||
|
</ogr:grid_rectangles>
|
||||||
|
</gml:featureMember>
|
||||||
|
</ogr:FeatureCollection>
|
@ -1666,3 +1666,66 @@ tests:
|
|||||||
OUTPUT_TABLE:
|
OUTPUT_TABLE:
|
||||||
name: expected/dropped_geometry.csv
|
name: expected/dropped_geometry.csv
|
||||||
type: vector
|
type: vector
|
||||||
|
|
||||||
|
- algorithm: qgis:creategridlines
|
||||||
|
name: Create grid (lines)
|
||||||
|
params:
|
||||||
|
CRS: EPSG:4326
|
||||||
|
EXTENT: -1,11.2,-4,6.5
|
||||||
|
HSPACING: 5.0
|
||||||
|
VSPACING: 3.0
|
||||||
|
results:
|
||||||
|
OUTPUT:
|
||||||
|
name: expected/grid_lines.gml
|
||||||
|
type: vector
|
||||||
|
compare:
|
||||||
|
geometry:
|
||||||
|
precision: 7
|
||||||
|
|
||||||
|
- algorithm: qgis:creategridpolygon
|
||||||
|
name: Create grid (rectangles)
|
||||||
|
params:
|
||||||
|
CRS: EPSG:4326
|
||||||
|
EXTENT: -1,11.2,-4,6.5
|
||||||
|
HSPACING: 5.0
|
||||||
|
TYPE: '0'
|
||||||
|
VSPACING: 3.0
|
||||||
|
results:
|
||||||
|
OUTPUT:
|
||||||
|
name: expected/grid_rectangles.gml
|
||||||
|
type: vector
|
||||||
|
compare:
|
||||||
|
geometry:
|
||||||
|
precision: 7
|
||||||
|
|
||||||
|
- algorithm: qgis:creategridpolygon
|
||||||
|
name: Create grid (diamond)
|
||||||
|
params:
|
||||||
|
CRS: EPSG:4326
|
||||||
|
EXTENT: -1,11.2,-4,6.5
|
||||||
|
HSPACING: 5.0
|
||||||
|
TYPE: '1'
|
||||||
|
VSPACING: 3.0
|
||||||
|
results:
|
||||||
|
OUTPUT:
|
||||||
|
name: expected/grid_diamond.gml
|
||||||
|
type: vector
|
||||||
|
compare:
|
||||||
|
geometry:
|
||||||
|
precision: 7
|
||||||
|
|
||||||
|
- algorithm: qgis:creategridpolygon
|
||||||
|
name: Create grid (hexagon)
|
||||||
|
params:
|
||||||
|
CRS: EPSG:4326
|
||||||
|
EXTENT: -1,11.2,-4,6.5
|
||||||
|
HSPACING: 5.0
|
||||||
|
TYPE: '2'
|
||||||
|
VSPACING: 5.0
|
||||||
|
results:
|
||||||
|
OUTPUT:
|
||||||
|
name: expected/grid_hexagon.gml
|
||||||
|
type: vector
|
||||||
|
compare:
|
||||||
|
geometry:
|
||||||
|
precision: 7
|
Loading…
x
Reference in New Issue
Block a user