Tagged Questions
0
votes
1answer
24 views
How to append a vector layer using Qgis and Python?
I am working on scripting some data processing using Qgis and Python, but I'm running across issues that I need to debug. Since my data is really large, and run-times can be lengthy, I would like to ...
1
vote
1answer
46 views
Looking for PyQGIS Syntax Examples/Guide
I am a long-time user of arcgis with intermediate experience python scripting for automation of geoprocessing workflows. I am moving towards using QGIS on the regular and I would like to dive into ...
0
votes
2answers
86 views
How to install Shapely, but got stuck into Python language
I have a MAC OSX 10.7.5 and am trying to learn how to use QGIS.
Following a couple of tutorials I came to know I have to install shapely.
I followed the instructions by the multi-cited ...
0
votes
0answers
36 views
SEXTANTE runalg and QgsVectorLayer issue
I'm trying to make a script for converting polygons to lines. But I'm having some issues while generating temporary layers.
In this script, I iterate through all the features of the input layer to ...
1
vote
1answer
164 views
How to add layer/raster with specific position in the QGIS layer list?
I use addRasterLayer(rast,'Name') but this adds the raster to the top.
It is possible to set position when I add raster at once? Is it possible??
0
votes
0answers
50 views
How to set point / line / polygon color and transparency with Python?
How can you set the color and transparency of a vector layer feature in QGIS using Python? Seems like a pretty simple and common task but I can't seem to find answered questions or examples.
Any ...
0
votes
0answers
62 views
Create a polygon shapefile using point as boundary
Following have two problems:
I am now have 4 point in a shapefile and I want to set the point's coordinate for boundary of a polygon
The points are xmin, xmax, ymin, ymax that can just be a ...
0
votes
0answers
26 views
Invalid multipolygon resulting from union of valid multipolygons
I'm using python (2.7) and ogr (1.9.2) to merge a bunch of multipolygons together. On their own, all the multipolygons are valid. After I iterate over them using ogr's Union function, I end up with ...
2
votes
1answer
91 views
How to store attributes of a large shapefile in a list?
I am trying to store the attributes of a shapefile into a list. With following code it works for smaller shapes:
addA = []
While provider.nextFeature(feat):
attrs = feat.attributeMap()
for ...
-1
votes
0answers
52 views
add a column to table attribute in QGIS by writing a query
i try to add a column to my attribyte table by executing a query in postgresql, but i have several problems. I ask for ur help. This is the code i have tried :
from PyQt4.QtCore import *
import ...
0
votes
0answers
56 views
Sextante script for statistic info
I want to generate a script for getting statistic information window from selected feature. For example i have two layer building(polygon) and railway(linestring). By using this tools i got a window ...
1
vote
0answers
84 views
How to write vector layer to csv file with geometry by PYTHON?
I use Python 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 ...
4
votes
1answer
134 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
37 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
15 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
54 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
58 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
22 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
50 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
73 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
79 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
39 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
75 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
55 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
108 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
58 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
57 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
91 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
38 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
votes
1answer
83 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
71 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
65 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
47 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
81 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
75 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
84 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
54 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
138 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
70 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 ...
3
votes
2answers
211 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
75 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
49 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
33 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
65 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
72 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
64 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
110 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 ...
1
vote
1answer
73 views
How can I change SQL query through a layer of an action (python)?
I have three layers from three diferent database tables.
When I click in other layer I want to change (with an action) the query of that three layers.
How can I do that?
Thank you
0
votes
1answer
45 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 ...





