QgisApp
Import
from pyqgis_wrapper.application import QgisApp
QgisApp(processing_path, prefix_path='/usr', providers=[], project=QgsProject.instance(), use_canvas=False, canvas_name='PyQGIS Map Viewer')
¶
Custom Qgis Application Allowing an easy use of processing algoritmh within your IDE.
You should still have an environment with qgis library available.
You can add custom or additionnal providers (such as plugins)
You can enable the use of a simple canvas within your IDE to help visualize your layer without the needs to write them or loading them into QGIS.
Access to qgs applications with QgisApp.app Access to qgs project with QgisApp.project Access to qgs processing with QgisApp.processing Access to qgs canvas with QgisApp.canvas
After instanciation you can import processing in your local scope if you want to avoid using QgisApp.processing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
processing_path
|
str
|
Path of the processing module. An helper function (find_module_path) is available in the misc module to help locating it. |
required |
prefix_path
|
str
|
Prefix where QGIS will look for his ressources, defaults to "/usr". On windows it's under : "C:/Program Files/QGIS * |
'/usr'
|
providers
|
typing.List[qgis.core.QgsProcessingProvider]
|
Additionnal providers to load, defaults to [] |
[]
|
project
|
typing.Union[str, qgis.core.QgsProject]
|
Project to use, defaults to QgsProject.instance() |
qgis.core.QgsProject.instance()
|
canvas_name
|
str
|
Name of the canvas windows, defaults to "PyQGIS Map Viewer" |
'PyQGIS Map Viewer'
|
Source code in pyqgis_wrapper/application/qgis_app.py
483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 | |
canvas
property
writable
¶
Canvas getter
Returns:
| Type | Description |
|---|---|
QgisCanvas
|
Canvas object |
processing
property
¶
processing module getter
app
property
¶
Qgis app getter
Returns:
| Type | Description |
|---|---|
QgsApplication
|
Current SGIS application |
project
property
writable
¶
QgsProject getter
Returns:
| Type | Description |
|---|---|
QgsProject
|
Instance of a QgsProject |
exit
property
¶
Close QgisApp.
save_project(file_path=None)
¶
Save a project to his associated file or a new file if provided.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
typing.Optional[str]
|
File to save the project to, defaults to None |
None
|
Source code in pyqgis_wrapper/application/qgis_app.py
650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 | |