Python bindings for QGIS.

learn more… | top users | synonyms (1)

1
vote
1answer
10 views

PyQGIS plugin debugging from Eclipse

having trouble with debuging QyPython plugins from Eclipse: - Win 7 x64 - QGIS 2.7 - Eclipse Luna with PyDev installed Tried to debug using Remote Debugger ...
0
votes
0answers
13 views

Creating Convex hull and finding buffer in QGIS

I have a layer and features are selected using Select Features by freehand tool and for that selected features, convex hull was done and for that convex hull i am trying to find buffer and write it in ...
1
vote
1answer
23 views

Buffer for features selected in the mapcanvas and writing to csv file

I have some features selected by using "Select Features by Freehand" tool in QGIS and try to find the buffer for those selected features alone and write the city and state names within in the buffer ...
1
vote
1answer
11 views

Use raster memory layer from QGIS processing result

I want to apply subsequent QGIS raster processing algorithms in a python script. I want to use memory layers for intermediate calculation results since I am only interested in the end result. As ...
1
vote
1answer
10 views

PyQGIS select layer by name, odd behavior in a plugin

I have a plugin with a function (triggered by a button) that selects a specific layer by name, then shows its attribute table. When I close the plugin and open it again, the attribute table pops up ...
1
vote
1answer
18 views

How to select from selection with PyQGIS?

The expression box has a handy "select from selection" button. Is there a way to emulate this with python? I have the basic expressions down, but can't find a way to do this.
1
vote
1answer
23 views

How to do a buffer operation for a polygon drawn by the user using python in QGIS

I have a polygon drawn on the map canvas.Say the polygon would be drawn by using "Measure Area" tool in qgis.Now, I want to do buffer for certain distance around that polygon.I can see the below ...
-3
votes
1answer
20 views

Warning message needed when there is no specific layer instead of python error

In my plugin, when I click a button it will call the findTheCityNames function which is attached below and get features if there is a particular layer. What I want is if there is no specific layer in ...
1
vote
1answer
42 views

How to get a layer by name in PyQGIS?

I have a plugin which finds buffer for list of cities, provided the distance. The state and city names are taken from the attribute table and gets filtered accordingly. What I want is My plugin should ...
-4
votes
0answers
28 views

Error in clicking browse button in my plugin [on hold]

I have a browse button in my UI in my plugin and when in click it, it throws an error which is attached. Also code is attached for reference. def __init__(self, iface): """Constructor. ...
-1
votes
1answer
28 views

Global name canvas is not defined

I am just trying to print the layer name using python in my QGIS plugin by following code. allLayers = canvas.layers() for i in allLayers: print i.name() It is saying an error: Global name canvas ...
1
vote
1answer
35 views

PyQGIS load dxf file as a vector layer

Can somebody help me with loading a dxf file as a vector layer with PyQGIS? Is QgsDataSourceURI an option? I've tried it with this code, but it didn't work. fitxer="/tmp/prova.dxf" uri = ...
1
vote
0answers
17 views

Vector Layer Symbology Export?

When programmatically creating / saving a QgsVectorLayer - implementation of the ExportSymbology functionality does not seem to exhibit the implied effects. Does such a command not indicate that the ...
0
votes
1answer
30 views

Cannot rename output file using standalone script for QGIS

I would like to rename all output files after my script has finished processing them by adding "(A)" after their file name (eg. Layer.shp -> Layer (A).shp). I received an answer from this post on the ...
0
votes
0answers
25 views

How to select the buffer region in map canvas in my plugin using python

I am developing a plugin which finds buffer by getting state name, city name and distance given by the user. The plugin works fine and writes the cities that matches the distance in a CSV file. What i ...
1
vote
1answer
37 views

How to add label to QgsVectorLayer by Python

my goal is to define label programmaticly for the case similar for the figure below: But didn't find any guidance how to do so using Python. I have a feeling it could be done using QgsLabel but ...
1
vote
1answer
19 views

Error while trying to replace a opened csv file with the newone in my plugin

My plugin does some basic geoprocessing functionalities and write the output as csv file. What i want is when i open some already writed output csv file in a writable mode and try to replace the same ...
1
vote
1answer
43 views

How to add multiple attributes to a newly created feature with PyQGIS

I am creating a form for updating the attribute values of the newly created feature. But when i am updating the values only one attribute field is getting updated. So if i want to update the multiple ...
2
votes
1answer
33 views

Does mapCanvas().refresh() not work in QGIS 2.6?

Before I used the function qgis.utils.iface.mapCanvas().refresh() to reload the map canvas after for example a layer color was changed from a plugin. But this is not working with QGIS 2.6 for me. ...
1
vote
1answer
60 views

How to export only certain column from selected feature to csv file in QGIS using python code

I have selected features in QGIS, I want to export only two columns from the selected features to a csv file automatically using python code. I have tried the following code: layer = ...
3
votes
2answers
43 views

How to define layer's CRS and avoid the CRS dialog in PyQGIS?

There is an existing Shapefile, which I want to add. At the moment my code looks like: self.iface.addVectorLayer(self.shpFilePath, "Track", "ogr") It works fine, but i want to define the crs ...
1
vote
1answer
45 views

Download file from network using PyQGIS 2.x

I have a python plugin targeting QGIS 1.8 that uses QgsNetworkAccessManager and QNetworkRequest to issue a GetCapabilities request to WMS servers. With 1.8 everything was working fine. Now we are ...
0
votes
0answers
22 views

Error in finding buffer

I am trying to find a buffer for city provided a state, distance and filepath to write as csv. What i am facing is that the name which i selected in the city combo box alone gets writed in the csv ...
2
votes
1answer
41 views

Adding new menu item to QGIS Desktop app

I need to add new menu item to the top level menu of QGIS Desktop (2.7.0); I.e. it shall be on same level as "Project", "Edit", "View", "Layer" etc. As far as I know there is pretty nice way how hide ...
1
vote
1answer
26 views

Removing the duplicate values in QCombo Box

In my plugin, there is a combo box which lists city names for a particular state. FOr example, if i chose a particular state and city will be some 20 names in the dropdown. But the first name alone ...
2
votes
1answer
36 views

Issues with PyQGIS while running a QgsZonalStatistics script

I have experienced a very bizarre issue with my PyQgis code. I simply want to load a raster and a vector layer to do zonal statistics, the first part works perfectly but for the zonal statistic I have ...
1
vote
0answers
23 views

How to change the attribute values of the feature using the custom feature form

When i am using the following command it opens the feature form with all the fields: qgis.utils.iface.openFeatureForm(qgis.utils.iface.activeLayer(), f) But i want to open a feature form with the ...
1
vote
1answer
38 views

How to compute buffers for certain features?

I used the following snippet of codes for finding buffer. def buffer(self): layer = self.iface.activeLayer() distance = float( self.dlg.DistancelineEdit.text() ) city = ...
0
votes
1answer
27 views

How to connect mouseclick to map canvas in QGIS?

How to connect mouse click to map canvas in QGIS using python script? I have two lines of code to connect mouse click to map canvas: button.clicked.connect(self.onClicked) ...
3
votes
1answer
67 views

How to import fromUtf8 in QGIS?

# Declare instance attributes self.actions = [] self.menu = self.tr(u'&City_searcher_plugin') # TODO: We are going to let the user set this up in a future iteration self.toolbar = ...
1
vote
1answer
40 views

convert vector (point shape) to raster (tif) using python gdal lib in qgis

I'm trying to convert a vectorlayer (point- shapefile) to a raster-dataset (tiff) using python gdal-library in qgis. On Graphical UserInterface I simple choose the menue ...
0
votes
1answer
43 views

How to trigger a QGIS action when a plugin button is clicked?

I tried calling the select free hand tool by below snippet of code. iface.actionSelectFreehand().trigger() I dnt have any idea how to call this when i am pressing a button in GUI. my gui is ...
0
votes
0answers
25 views

Error in my buffer plugin

In my buffer plugin, i tried the following code # Get buffer distance and selected city dist = float( myLineEdit.text() ) city = myComboBo.currentText() # Get the feature corresponding to the ...
1
vote
1answer
44 views

How to call default tool in QGIS inside plugin using python script?

I want to create a plugin which can draw irregular polygons in QGIS. For that, I want to call the Select features by freehand default tool inside my plugin. How can I do this within a python script?
0
votes
0answers
19 views

Reading long lat values from line feature

I have created a vector layer selecting starting point and end point of the line and created the line by line geometry in QGIS. How do i read the all long. lat. values in the line feature? v_layer = ...
0
votes
1answer
27 views

How to enable the snapping for a layer with the tolerance value with python programming

I have a vector polygon and vector polyline layer. I want to enable the snapping for both the layer with tolerance value? How can i do that using python programming. I have tried this code but getting ...
2
votes
1answer
54 views

How to save the Map Canvas as PNG with transparent background programmatically?

I wrote a script to create a big number of heatmaps for a given scenario. I would like to save the result of every heatmap as a png image. I have figuered it out doing it with simple Map Rendering but ...
1
vote
0answers
22 views

QGIS 2.6 SAGA Processing Algorithm, “Add grid values to shapes”, produces NULL Values

I'm using QGIS 2.6 Brighton on Windows with SAGA 2.0.8 installed using OSGeo4W. I have the same versions installed on OSX as well which is not having this problem. On Windows, I'm trying to extract ...
2
votes
1answer
28 views

QGIS gets stuck when running script to automatically refresh layer [closed]

I have a QGIS layer that represents a set of links and nodes to show the streets of a city and the traffic speeds on each street. I've been trying to write a script so that if I change the speeds in ...
0
votes
0answers
24 views

Why is the display of QgsMessageBar delayed?

When a function is called - a file is tested for existence. This checksum pushes a messageBar() object for both circumstances (True/False), yet the actual bar does not display in MapCanvas until ...
1
vote
1answer
43 views

How to exclude a certain attribute from being added to the Processing script output layer?

I have a working script to split a layer by field attributes and save the single features as files: ##[User scripts]=group ##input=vector ##class_field=field input ##output=output file from ...
0
votes
0answers
39 views

Is there any way to create user login for single project in QGIS?

Is there any way to create user login for single project in QGIS? I want to track changes on database when users update features. I know that I can do this on database level but is there way to do ...
-1
votes
0answers
35 views

To find buffer using python for a plugin

In my buffer plugin which i am creating, state is selected in a combo box , city is filtered based on the state selected in a other combobox. Distance value will be get from the lineedit box. After ...
1
vote
1answer
23 views

Getting a number from QLineEdit and passing it to the buffer function

I am developing a plugin which finds buffer. In that i am using lineedit for getting distance from the user and pass it to the buffer function. My current code throws an error "'QLineEdit' object has ...
1
vote
1answer
48 views

Qgis 2.7 (Dev) feature rotation?

Curious if the following code has a blatant error that has been overlooked with respect to rotating a single polygon feature. The *.geometry().rotate(...) returns a '0', indicating it was successful ...
2
votes
1answer
71 views

How does QGIS know there is a plugin update?

I've created a plugin and hosting the installation zip and xml file on a local network repository (for company use). Everything works fine but every time a user opens QGIS, it shows that the plugin ...
1
vote
1answer
44 views

Getting values from Qt widgets and using them for a buffer

I am writing a simple plugin that finds buffer. My gui has 2 combo box and 1 Line edit. The first combo box will have a drop down of values from column 'States' and 2nd combo will have a drop down of ...
2
votes
1answer
64 views

How to move layers in the QGIS Table of Contents via PyQGIS?

I have loaded two layers in canvas and would like to move the layers using the following code in TOC, but it is not moving the layers to the position based on the index given. from PyQt4.QtCore ...
2
votes
0answers
39 views

How do I install a external package in QGIS?

Is it possible to install an external package in QGIS? For example: Can I install ReportLab in order to create a plugin to make pdf reports? Or Pandas. How can I install Pandas in QGIS Python ...
2
votes
1answer
28 views

How to apply a filter to multiple vector layers in QGIS?

I am trying to apply an attribute filter to multiple layers in QGIS at once. The filter is to be applied to .osm data brought in through PostGIS to QGIS. I have tried selecting multiple layers -> ...