Tagged Questions
0
votes
0answers
14 views
Sextante script for statistic info
I want to generate a script for getting statistic info from 2 layers. One of the layer is in polygon geometry another one is in linesting geometry. I just want to get a screen about basic statistics ...
0
votes
0answers
27 views
How to write vector layer to csv file with geometry?
I try to write vector layer file to csv file with this code
QgsVectorFileWriter.writeAsVectorFormat(mylayer, r'c:\temp\xyz.csv', "utf-8", None, "CSV")
it can export to xyz.csv but only attribute ...
4
votes
1answer
62 views
How to set up Python 2.7 to work in both QGIS and ArcGIS?
I have both ArcGIS 10.1 and QGIS 1.8 installed and both include Python 2.7 in slightly different setups and in different folders (c:\Python27\ArcGIS10.1\ and c:\Program Files (x86)\Quantum GIS ...
0
votes
0answers
31 views
Fill up polygons with field value
I have now defined my renderer with a color map
I want to fill it with a value in the end field of my shape file's attribute table with python
how to do it??
I use QGIS 1.8.0 with python 2.7.3
0
votes
0answers
12 views
In QGIS Python can you nest QgsFeatureIterators on the same layer
I'm using the QGIS Weekly 1.9.0 in order to access the getFeatures(QgsFeatureRequest) method. The script is run in the Script Runner Plugin v0.71
Can anyone tell me what's wrong with this code? The ...
-1
votes
0answers
45 views
How to assign a SQL query to a table attribute? [closed]
I have created a plugin with "plugin builder." Now I seek to connect my plugin to postgres. I have a shapefile and I try to find a script in Python that can assign a SQL query to my table attribute. ...
1
vote
1answer
32 views
Combining polygon geometries with python and QGIS segfaults
I am trying to combine polygons, using Qgis 1.8, and every time I run this script in the python console, I get a segmentation fault. Here is the script:
from PyQt4.QtCore import *
iface = ...
0
votes
0answers
20 views
How to change value of an Line edit dynamically
I create a form in QT4 and compile with pyuic4. it create an form.py
I want to modify the value of the line edit dynamiclly with code.
I put this code in the form.py but never happen:
...
0
votes
1answer
40 views
Make many lines in one layer (Python)
I what to create many lines with this code:
v_layer = QgsVectorLayer("LineString", "cable", "memory")
pr = v_layer.dataProvider()
seg = QgsFeature()
...
0
votes
2answers
67 views
Python to get ids from shp dont return all records
I have some Python code to get the ids and georeference from a shapefile:
canvas = qgis.utils.iface.mapCanvas()
allLayers = canvas.layers()
nos = QgsFeature()
for i in allLayers:
if ...
0
votes
1answer
73 views
How to convert geometry of SHP to decimals
I try to create a line with two points. These points are obtained in a SHP layer.
How can i convert that points to decimals?
Thank you
0
votes
1answer
30 views
QGIS Python - Convert geometry from Postgres to QgsPoint()
I have made a query in Postgres to get some points to use with python.
This points are in geometry data. How can I convert that geometry in decimals to use QgsPoint() in python?
Thank you
1
vote
1answer
70 views
Can I open a form in layer action?
I want to open a form (made in QTDesign) in the layer action. It is possible?
0
votes
0answers
17 views
QGis non blocking notifications with pyqgis [duplicate]
I'm searching for the way to use the new QGis non blocking notification system with the QGis python wrapper. I found informations on this fonctionnality but nothing on how to use this especially with ...
3
votes
1answer
40 views
Is it possible to batch clip rasters in Quantum GIS?
I have been able to batch clip rasters in one directory using python in ArcGIS. However, I am not sure how to do the same in Quantum using the python console. Is this possible? If there are different ...
1
vote
1answer
99 views
spatialite.dll with Python and QGIS - the specified module could not be found
I'm having a bit of a nightmare getting to the bottom of this DLL loading problem. The stand alone script works absolutely fine but the exact same code does not work within QGIS.
import sys
from ...
-3
votes
1answer
55 views
how to call a function when I press the button? [closed]
def function(self):
QMessageBox.information(self.iface.mainWindow(),
QCoreApplication.translate('HelloWorld', "HelloWorld"),
QCoreApplication.translate('HelloWorld', ...
0
votes
1answer
53 views
How to access the button on the form?
I have a form that appears when you start the plugin.How do I properly apply to the button on the form, so that when you click on the button performed "function".
import sys,os
import win32api
from ...
0
votes
1answer
78 views
How can I create a line with three points with Python in QGIS?
I'm new to Python and I'm having some dificulties. I want to create a simple layer with a line in the console of QGIS with Python. How can I do that?
0
votes
1answer
28 views
Check if layer is a QGSVectorLayer from Python Plugin within QGIS
I am trying to extend some concepts in the QGIS Workshop tutorial. Basically, I would like to check if the layer is of type "QGSVectorLayer". In the QGIS Python console, I am able to type
canvas = ...
1
vote
0answers
17 views
How to align QProgressBar label in QGIS messagebar? [migrated]
Unable to align the QProgressbar label in Qgis Messagebar. see the image below
While progressbar is updating,the label is vanished. so i tried the alignment for progressbar as shown below but its ...
-1
votes
1answer
61 views
QGIS and Python - create line with multiple points in postgis
How can I create a line, with Python functions, with many points that are records in Postgis?
Thank you
0
votes
1answer
59 views
AttributeError: HelloWorld instance has no attribute 'connect'
Here's the code:
import sys,os
import win32api
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qgis.core import *
import ctypes
from PyQt4 import uic
class HelloWorld:
def ...
0
votes
1answer
55 views
How to set Marker Line symbol for QgsVectorLayer by using Python?
QgsVectorLayer Right click->Properties->Style->Single symbol->click on simple line in tree node ->symbol layer type -> Marker line
Kindly help me to set marker line symbol programmatically by using ...
0
votes
0answers
38 views
Missing SIP Module in QGIS on Debian Squeeze
Python environment is not loading and shows this error:
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named sip
Versión de Python:
2.6.6 (r266:84292, Dec 26 2010, ...
0
votes
2answers
72 views
How to make line with arrow head in QgsVectorLayer using python?
I need to draw line with arrow head or after drawn the line i need to make it as arrow head line by using python. or can we set any arrow head symbol for line features by using python?
Kindly help me ...
0
votes
0answers
62 views
How to use more than one QT form in Qgis Python? [closed]
I need a help to use multiple qt forms in PyQgis. For example, i need to open one qt form after the login form.
I tried like this:
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qgis.core ...
2
votes
1answer
64 views
How to access the road graph plugin in python?
I am developing a few scripts in Python for QGIS 1.8 to automate some geo-tasks and one of them would be to calculate the shortest distance from a hospital to each building in a town.
I would like to ...
0
votes
0answers
47 views
qgis python app how to add edit feature button?
I'd like to develop a QGIS Python app for plotting points and editing the attributes. I've started with the tutorials here: http://blog.qgis.org/?q=node/59 and read the cookbook ...
5
votes
1answer
117 views
How to create a dropdown menu in QGIS Toolbar with Python
I Have a set of some QAction in my QGIS-Plugin and they are created and added to the toolbar like this
icon = QIcon(":/action1.png")
self.action1 = QAction(icon, u"Action 1", self.iface.mainWindow())
...
1
vote
1answer
65 views
How to “Merge Selected Features” with python?
I have been looking for the answer to this question for some time now, but can't seem to find it! My problem is straight forward:
I have one layer
It contains lots of features (only polygons), say ...
0
votes
0answers
19 views
Change offset of geotiff file [migrated]
I need to change the offset of some tiff files that I am exporting from Qgis.
Qgis gives them a offset of 0xbd72, while the program I need to load them in to only reades files with an offset of ...
3
votes
2answers
199 views
How to automatically reloaded raster layer if source is changed in QGIS?
How to automatically reloaded raster layer if source is changed? (The path is the same but inside source file are changes)
I use:
qgis.utils.iface.mapCanvas().refresh()
but layer not refresh.
#
...
0
votes
1answer
70 views
How can i select many rows from a table?
I want to create an action that select many rows from PostGIS table to show many lines in QGIS.
How can i select many rows from table with python to add these rows in a layer?
Thank you
1
vote
1answer
48 views
How to get a message when the map is moved in QGIS?
I want to get a message when every time I move the map.
I had:
def info(self):
QMessageBox.information( self, self.tr( "Info" ), self.tr("info") )
I suppose that used to be something like ...
1
vote
0answers
29 views
How to programmatically change an SVG symbol in the Vector Layer?
I'm trying to change the symbol used in a layer via Python. I've been able to tunnel through a vector layer to the symbol layer, but I don't know how to change the symbol it's using. I'd like to ...
2
votes
1answer
59 views
Writing python plugin: How terminate plugin from script without closing QGIS?
I'm writing a QGIS conversion plugin in python to be able to create Obstacle-files for a model from shapefiles.
What I want to do now is just to close the plugin cleanly. This means, to close the ...
1
vote
1answer
57 views
Joining table to shapefile with pyQGIS
Joining shapefiles is a relatively straightforward proess in QGIS using 'add vector join' in the layer properties menu. I can add a csv file as a vector layer, as well as a shapefile, and join the two ...
2
votes
1answer
56 views
How to see print commands through Python Script while programming plugin for QGIS?
This might sound like a silly question.
Is there a way that from running a custom plugin made for QGIS that a Python Shell can appear along when the plugin is run, like a debug screen. I'm asking ...
4
votes
1answer
97 views
Speed of editing attributes in QGIS from a Python plugin
I'm trying to edit the value of an attribute for each feature in a layer using a QGIS Python plugin. I've found that doing this outside of editing mode is much slower than while editing (even ...
0
votes
1answer
42 views
How to reopen a plugin-window in QGIS?
I am currently taking my first steps in playing around with programming a plugin in python 2.7 for QGIS 1.8. While my plugin does what it should, I would like to make it more userfriendly. At the ...
0
votes
0answers
12 views
Sextante Modeler Error “global name os is not defined” [duplicate]
I want to generate a model whic reclassify radter values. So i added Saga reclassify grid values tool to Modeler and saved the model. When i run the model i got this error both on Ubuntu OSgeolive 6.0 ...
0
votes
0answers
54 views
Fill polygon with colour depending on the value in MS SQL Server table
I'm using QGIS 1.8. Windows 7. I have a table in MS SQL Server 2008 R2 database with two fields: id and density(int). There are several polygons in QGIS. How can I set color of polygion depending on ...
2
votes
2answers
69 views
How to determine the coordinates of the corners of the raster layer
How can we determine the coordinates of the corners of the raster layer? The image opens function QgsRasterLayer.
1
vote
0answers
86 views
How to calculate average value within a polygon(in Qgis with Python)?
Now I have a point and polygon shapefile
and I want to calculate the points' average value within each polygons
How to do it with python?
I tried to find out but google gives me a lot of raster ...
6
votes
1answer
99 views
How to save python session in QGIS?
After running a lot of scripts in QGIS' python console, I have more than 10 dictionaries and lists, and I need these for further analysis. Is there a way to save python session, with all these ...
1
vote
1answer
58 views
How to add MS SQL table using python console?
I have MS SQL Server 2008 R2 database. How to add MS SQL Table using python console in QGIS?
0
votes
0answers
78 views
qgis plugin: “WindowsError: [Error 6] The handle is invalid”
OS: Windows 7 64bit
GIS: QGIS 1.8 (qgis.org/downloads/QGIS-OSGeo4W-1.8.0-2-Setup.exe)
path variable:
GISBASE=C:\Program Files (x86)\Quantum GIS Lisboa\apps\grass\grass-6.4.3RC2
...
0
votes
1answer
70 views
Using the API of QSpatiaLite plugin
I am using the popular QSpatiaLite plugin for QGIS. Since I am creating and modifying SpatiaLite tables directly with Python (using pyspatialite), I wonder whether I can automate tasks such as ...
0
votes
1answer
56 views
How to handle adding a PostGIS layer in pyQgis without saving password?
I'm writing python plugin and trying to find the right way to add PostGIS layer on the map without storing user password.
After adding layer on the map, I strip out the password from uri like this:
...

