Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Python bindings for QGIS.
2
votes
Accepted
Raster Subtraction with QgsRasterCalculator in PyQGIS
Like Joseph said, there is an error in the first parameter of QgsRasterCalculator. But it must be string, unlike Josephs suggestion. So i tried this:
calc=QgsRasterCalculator ('%s - %s'%(target.ref, …
5
votes
Load PostGIS layer/table to QGIS canvas using Python
The sql-parameter is not what it sounds like. It only takes a where-clause, like 'id = 20' in your case.
So try:
uri.setDataSource("public","table", "the_geom", 'id = 20',"gid")
0
votes
Running Python script in QGIS startup?
You can register/load and run a plugin like this:
import sys
sys.path = ["your/path/aboveMyPlugin"] + sys.path
import MyPlugin
plugin = MyPlugin.classFactory(iface)
plugin.initGui()
plugin.run()
My …
1
vote
startup.py in QGIS not executed
not fulfill the requirements of a plugin, which has the structure of a python package, which means it consists of a folder whith file init.py, a function named classFactory and more, described in the pyqgis …
10
votes
Accepted
Importing paths for QGIS 3 standalone scripts
For QGIS3 we need a special environment, that differs from the QGIS2-Versions. Because not only Python changed to python3 but also pyqt5/Qt5 need different settings.
To work with a complete environme …
3
votes
Converting QgsRaster object to array
Barry Rowlingson build an plugin for QGIS2 called "Rasterlang" (https://www.maths.lancs.ac.uk/~rowlings/Software/Qgis/Plugins/rasterlang/), inside there is a modul named layers.py with a function call …
5
votes
Updating layer extent after changing source in PyQGIS?
This works for me:
if iface.mapCanvas().isCachingEnabled():
lyr.triggerRepaint()
else:
iface.mapCanvas().refresh()
5
votes
Accepted
Error when using input() pyqgis (RuntimeError: input(): lost sys.stdin) QGIS 3
from PyQt5.QtWidgets import QInputDialog
def getTextInput(title, message):
answer = QInputDialog.getText(None, title, message)
if answer[1]:
print(answer[0])
return answer[0]
…
5
votes
QGIS plugin development and libraries
In my comment I mentioned two different possibilities to include additional python modules with a QGIS python plugin. Regarding how and where a plugin is installed, it is not comfortable or even possi …
1
vote
QGIS 2.18 ImportError: DLL load failed: The specified module could not be found
I'm using a batchfile to set the environment for python and qgis, like this:
SET QGIS_PREFIX_PATH=%OSGEO4W_ROOT:\=/%/apps/qgis
SET PYTHONPATH=%OSGEO4W_ROOT%\apps\qgis\python
SET PYTHONHOME=%OSGEO4W_R …
2
votes
Accepted
Add postgis temporary table using pyqgis into canvas failed
You don't need the sql parameter! In particular, it only takes the where clause, so the name sql is misleading.
See Adding PostGIS layer from QGIS Python plugin for a simple example.
supplement:
if …
0
votes
Accepted
qgis utils.py appends to a dictionary / hash
If the problem is to load a plugin inside qgis python console, you may check this code:
import qgsAffine # or another plugin modul
plugin = qgsAffine.classFactory(iface) # standard interface for regi …
1
vote
Using Windows Batch File (.bat) for executing QGIS Python program without opening QGIS Software
I tried for long and found the following points are important
Always use the OSGEO4W-Shell to execute an osgeo-program, don't use cmd.exe directly. (The shell executes all batch files in %OSGEO4W_RO …
1
vote
Accepted
QGIS Plugin does not show attributes
I broke it down to a simple example. Here, at least one vector layer must be loaded in QGIS and it must be the top one. Then you can execute this in the python console as a script:
from PyQt5.QtWidge …
2
votes
Creating standalone python Script using PyQGIS?
Second, a standalone pyqgis script has to "prepare" or init a pyqgis app, analog to a qt5 app. … There is a description for writing standalone scripts in the pyqgis developer cookbook
And finally call that script through the batch file created in the first step. …