Utilizas mal TYPE
código. Hay que utilizar 2
para la rejilla rectangular. 3
significa diamante.
params = {'TYPE':2, ...} # 2: rectangle
Para más detalles sobre el algoritmo, intente
import processing
processing.algorithmHelp("qgis:creategrid")
y obtener más información:
Create grid (native:creategrid)
This algorithm creates a vector layer with a grid covering a given extent. Elements in the grid can be points, lines or polygons. The size and/or placement 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. The top-left point (minX, maxY) is used as the reference point. That means that, at that point, an element is guaranteed to be placed. Unless the width and height of the selected extent is a multiple of the selected spacing, that is not true for the other points that define that extent.
----------------
Input parameters
----------------
TYPE: Grid type
Parameter type: QgsProcessingParameterEnum
Available values:
- 0: Point
- 1: Line
- 2: Rectangle (Polygon)
- 3: Diamond (Polygon)
- 4: Hexagon (Polygon)
Accepted data types:
- int
- str: as string representation of int, e.g. '1'
- QgsProperty
EXTENT: Grid extent
Parameter type: QgsProcessingParameterExtent
Accepted data types:
- str: as comma delimited list of x min, x max, y min, y max. E.g. '4,10,101,105'
- str: layer ID. Extent of layer is used.
- str: layer name. Extent of layer is used.
- str: layer source. Extent of layer is used.
- QgsMapLayer: Extent of layer is used
- QgsProcessingFeatureSourceDefinition: Extent of source is used
- QgsProperty
- QgsRectangle
- QgsReferencedRectangle
- QgsGeometry: bounding box of geometry is used
HSPACING: Horizontal spacing
Parameter type: QgsProcessingParameterDistance
Accepted data types:
- int
- float
- QgsProperty
VSPACING: Vertical spacing
Parameter type: QgsProcessingParameterDistance
Accepted data types:
- int
- float
- QgsProperty
HOVERLAY: Horizontal overlay
Parameter type: QgsProcessingParameterDistance
Accepted data types:
- int
- float
- QgsProperty
VOVERLAY: Vertical overlay
Parameter type: QgsProcessingParameterDistance
Accepted data types:
- int
- float
- QgsProperty
CRS: Grid CRS
Parameter type: QgsProcessingParameterCrs
Accepted data types:
- str: 'ProjectCrs'
- str: CRS auth ID (e.g. 'EPSG:3111')
- str: CRS PROJ4 (e.g. 'PROJ4:…')
- str: CRS WKT (e.g. 'WKT:…')
- str: layer ID. CRS of layer is used.
- str: layer name. CRS of layer is used.
- str: layer source. CRS of layer is used.
- QgsCoordinateReferenceSystem
- QgsMapLayer: CRS of layer is used
- QgsProcessingFeatureSourceDefinition: CRS of source is used
- QgsProperty
OUTPUT: Grid
Parameter type: QgsProcessingParameterFeatureSink
Accepted data types:
- str: destination vector file, e.g. 'd:/test.shp'
- str: 'memory:' to store result in temporary memory layer
- str: using vector provider ID prefix and destination URI, e.g. 'postgres:…' to store result in PostGIS table
- QgsProcessingOutputLayerDefinition
- QgsProperty
----------------
Outputs
----------------
OUTPUT: <QgsProcessingOutputVectorLayer>
Grid