Python bindings for QuantumGIS (QGIS)
0
votes
0answers
10 views
Creating a link layer by connecting a point layer to a line layer
In the map shown below, I have manually created the dummy lines (in green).
Using python, and without using PostGIS or sextante, I would like to automate the creation of these dummy links between a ...
1
vote
1answer
57 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 ...
1
vote
0answers
26 views
Spatial Filter in Qgis Using Python
Is it possible to create buffer and get intersected features in Qgis using Python?
I did in ArcObjects.but i need the same in QGIS also.
Dim topo As ITopologicalOperator
topo = chkPoint
Dim sFc As ...
0
votes
0answers
7 views
keyPressEvent on QDialog using IPython [migrated]
When Escape Key was pressed, QDialog will hide automatically. How to use keypressEvent for QDialog using IPython?
0
votes
1answer
22 views
Getting error in compiling make file for plugin build in qgis 1.8
I am using QGIS 1.8 for building plugin. For developing i am using following ref this link example. where in this step 6 where compile the makefile in OSGeo4W. gives error pyuic4:command not found. I ...
1
vote
1answer
42 views
Qgis 1.9 issues with python [closed]
I already installed the version 1.9 of Qgis and when i runned e Script python on i could
this error 'NoneType' object has no attribute 'children' however it works fine on qgis 1.8
could someone ...
0
votes
0answers
28 views
SEXTANTE v.to.rast.attribute issue in script
I'm trying to convert a vector layer to a raster by using the GRASS function v.to.rast.attribute in Python.
My code doesn't throw any error but the raster image is only a square of 1px. But when I'm ...
0
votes
2answers
54 views
How to add QGIS Python API Intellisense support in Aptana Studio3/Pydev
I'm developing QGIS plugins using PyDev in Aptana Studio 3 and I would like to know if it's possible to make it aware of the QGIS API and add some "intellisense" functionnalities when programming. For ...
2
votes
3answers
77 views
How to find the polygon inside which a point lies?
I have a layer with polygonal features. Each feature has attributes and values. I also have a list of co-ordinates and I would like to know which feature (or polygon) the co-ordinates lie in.
Could ...
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
1answer
30 views
Script for converting date and time formats [closed]
Can anyone please throw some light on the date and time conversions:
How do I convert Time which is in single field as "1700" to "17:00".
and same with date which is in single field as "2011/02/20" ...
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
54 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 ...
1
vote
0answers
86 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 ...
0
votes
0answers
34 views
How to create a renderer with different colors in pyqgis?
I want to know how to change the color of a polygon shapefile in qgis using python console.
I have a list of values and i need to change the polygon color for each value, like a render!
Thanks a ...
0
votes
0answers
16 views
connexion to postgres and update attribute table of a shapfile in QGIS [duplicate]
I have created a plugin with "plugin builder" , now I search to connect my plugin to postgres. I have a shapfile and I try to find a script in Python that can use to assign a SQL query to my table ...
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
74 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
33 views
How to use expression in QgsVectorlayer label by using python?
how to show the two field values as a label on features. I have done it for a field called "ErrorDescr" with this i need to show another field values. Other field is "MarkerId"
...
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 ...
4
votes
1answer
111 views
How can I programatically create and add features to a memory layer in QGIS 1.9?
I had a working plugin in QGIS 1.8 which read data from an MSAccess database and added it to a series of memory layers. There is some processing involved in the interim so I don't think simply using ...
1
vote
1answer
57 views
Understanding the QGIS API documentation to write python code
I am not sure how to use the API documentation to code in Python.
For example, I want to determine whether a layer is a point, line or polygon layer and found the following in the API documentation:
...
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
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 ...
0
votes
0answers
55 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 ...
1
vote
1answer
69 views
open QGIS project with parameters
I am looking at a piece of work to deploy QGIS as the standard within an organisation. There is an existing piece of software that I need to link to QGIS so that when a button is pressed within the ...
3
votes
1answer
96 views
How to find the nearest line to a point in QGIS? [duplicate]
My question is that given a point and few lines, how should I go about finding the nearest line to the point?
I am aware of How to I find the nearest line to a point?, but that isin ArcGIS and ...
7
votes
1answer
187 views
How to draw perpendicular lines in QGIS?
I have a situation like this:
What I need to do is to connect each point to every line that is at most, let's say 200 m, away from the point. In other words, I need to draw a perpendicular line ...
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 ...
1
vote
2answers
112 views
Creating QGIS layers in python console vs stand-alone application
I am having trouble creating a QGIS vector layer in a stand-alone python script while exactly the same code works fine in python console inside QGIS. The following code results in a proper ...
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.
#
...
7
votes
1answer
146 views
Is it possible to show our custom message in QGIS Status bar using python?
Is there any way to show our custom message in Qgis Status bar using python? Just like in arcgis "IApplication.statusbar.message(0) = "Please wait..."
like that is there any option to show ...
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
2answers
96 views
Get features by their attributes in Qgis using python and SQL filters
How to Get features by their attributes (similar to Iqueryfilter in arcobjects) in Qgis using python? Instead of getting all features and filter it manually, is there any option to use whereclause to ...
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
65 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
113 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 ...
2
votes
0answers
65 views
Python Script that calls the Voronoi Polygons Function?
I've been looking to see if there was a way to call Voronoi Polygons function found in Vector/Geometry Tools, directly from the code but I have not found one. Does this currently exist? Is there a way ...
1
vote
1answer
49 views
How to get CRS of a raster layer in pyqgis?
I have this problem accessing to the coordinate reference system(crs) of a raster layer map.
I wonder if such thing is possible?
I have used this xml from GDAL open map service to load in a raster ...
2
votes
2answers
78 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.
6
votes
1answer
101 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
67 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
1answer
60 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:
...
6
votes
1answer
131 views
How to address the new “Task-Completed” QgsMessageBar in Python?
I am really amazed what huge steps the QGIS development has taken in the last months. The new iconset, the improved Print composer and many more changes to be seen in QGIS 2.0 are really awesome!
...
2
votes
1answer
101 views
How to add one or more points to an existing polyline or polygon?
Using the following code, I make a polyline with two points.
vl = QgsVectorLayer("LineString", layerName, "memory")
pr = vl.dataProvider()
vl.startEditing()
fet = QgsFeature()
...
2
votes
1answer
45 views
How to check if two qgsPoints are equal in PyQgis
I have two points:
a=QgsGeometry.fromPoint(QgsPoint(227739,908343))
b=QgsGeometry.fromPoint(QgsPoint(227739,908343))
but when I run:
a==b
it returns False.
What am I doing wrong?
Update:
it ...
0
votes
1answer
57 views
How to save after using fet.setFeatureId in pyQGIS?
By using the following code, I want to change the id of the line when saving the line. But the setFeatureId command, gives a false when doing the commitChanges(). Any idea how to change the id?
vl = ...
3
votes
2answers
102 views
How to write an equivalent to MapBasic's CreateLine in pyQGIS?
I know this kind of question has been asked, in part, before - specifically: Seeing QGIS Python Commands and: How is object created as line using createline stored in .tab file?
but this is a specific ...





