Class: QgsSnapToGridCanvasItem¶
Shows a grid on the map canvas given a spatial resolution.
Added in version 3.4.
Class Hierarchy¶
Base classes¶
An abstract class for items that can be placed on the map canvas. |
|
Methods
The CRS in which the grid should be calculated. |
|
Enable this item. |
|
A point that will be highlighted on the map canvas. |
|
The resolution of the grid in map units. |
|
The CRS in which the grid should be calculated. |
|
Enable this item. |
|
A point that will be highlighted on the map canvas. |
|
The resolution of the grid in map units. |
- class qgis.gui.QgsSnapToGridCanvasItem[source]¶
Bases:
QgsMapCanvasItem
- __init__(mapCanvas: QgsMapCanvas | None)
Will automatically be added to the
mapCanvas
.- Parameters:
mapCanvas (Optional[QgsMapCanvas])
- crs(self) QgsCoordinateReferenceSystem [source]¶
The CRS in which the grid should be calculated. By default will be an invalid
QgsCoordinateReferenceSystem
and as such equal to the CRS of the map canvas.- Return type:
- point(self) QgsPointXY [source]¶
A point that will be highlighted on the map canvas. The point needs to be in map coordinates. The closest point on the grid will be highlighted.
- Return type:
- precision(self) float [source]¶
The resolution of the grid in map units. If a crs has been specified it will be in CRS units.
- Return type:
float
- setCrs(self, crs: QgsCoordinateReferenceSystem)[source]¶
The CRS in which the grid should be calculated. By default will be an invalid
QgsCoordinateReferenceSystem
and as such equal to the CRS of the map canvas.- Parameters:
- setEnabled(self, enabled: bool)[source]¶
Enable this item. It will be hidden if disabled.
- Parameters:
enabled (bool)
- setPoint(self, point: QgsPointXY)[source]¶
A point that will be highlighted on the map canvas. The point needs to be in map coordinates. The closest point on the grid will be highlighted.
- Parameters:
point (QgsPointXY)