QgisCanvas
Import
from pyqgis_wrapper.application import QgisCanvas
QgisCanvas(qgis, canvas_name='PyQGIS Map Viewer')
¶
Bases: qgis.PyQt.QtWidgets.QMainWindow
Custom canvas to be executed within your IDE
TODO: Add a button or a right click on a layer menu to zoom to the layer extent.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
qgis
|
qgis.core.QgsApplication
|
Application in which the canvas will be launched |
required |
canvas_name
|
str
|
Title for the canvas, defaults to "PyQGIS Map Viewer" |
'PyQGIS Map Viewer'
|
Source code in pyqgis_wrapper/application/qgis_app.py
290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 | |
show
property
¶
Launch the canvas.
Current instance can't be modified after.
on_layer_selected(layer)
¶
When user selects a layer in the tree
Source code in pyqgis_wrapper/application/qgis_app.py
369 370 371 372 373 374 | |
load_layers(layers)
¶
Load layers in a QgsTreeLayer (legend)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
layers
|
typing.Union[qgis.core.QgsMapLayer, typing.List[qgis.core.QgsMapLayer]]
|
description |
required |
Source code in pyqgis_wrapper/application/qgis_app.py
408 409 410 411 412 413 414 415 416 417 418 | |
load_project(project)
¶
Load the layers from a QgsProject in a QgsTreeLayer (legend)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project
|
str
|
Project to load |
required |
Source code in pyqgis_wrapper/application/qgis_app.py
420 421 422 423 424 425 426 427 428 429 430 | |
closeEvent(event)
¶
Intercept the close event and preserve layers by taking ownership.
Source code in pyqgis_wrapper/application/qgis_app.py
445 446 447 448 449 450 451 452 453 454 455 456 457 458 | |