Python bindings for QGIS.

learn more… | top users | synonyms (1)

2
votes
1answer
35 views

Triggerring HeatMap Plugin using Python

I am trying to access heatmap plugin from Raster -> HeatMap -> HeatMap using PyQGIS.If my custom button is clicked, the heatmap plugin dialog box should opens.I know the heatmap is a c++ plugin.Is it ...
3
votes
1answer
96 views

Script that runs automatically from the QGIS Python Console when QGIS starts, using schedule tasks on Windows 10

I'm working with QGIS 2.8 and windows 10. Is it possible that after open QGIS using the schedule tasks from windows 10, I could open the python console and run a script within QGIS programmatically. ...
4
votes
0answers
29 views

Using QgsNewVectorLayerDialog

I am using QgsNewVectorLayerDialog for taking user input for creating a new shape file. When the user clicks OK i am reading the inputs selected by the user using the following code. dlg = ...
3
votes
3answers
60 views

How to add all “.dat” files (raster) into QGIS, in a defined directory and defined legend (style), using python code

I'm using a QGIS 2.8.3 in Windows 10. I've added just one raster ("dat" file) to the QGIS, with a defined legend, using the following code. If I wanted to add all the "dat" files into a directory how ...
2
votes
1answer
80 views

Customising QGIS Map Composer default output directory and file name suffix?

I am using QGIS for map making , I am adding multiple vector and raster layers and then finally for map making I am moving to the map composer. When I am exporting the map from Map composer , I want ...
5
votes
1answer
56 views

How can I print the text of help(some_method_class) in my QGIS plugin?

I'm developing a QGIS plugin to search classes and classes methods of QGIS. The dir equivalent option it was answered in: How can I access to elements in dir(some_class) of PyQGIS without a ...
4
votes
2answers
99 views

How to populate QTableWidget via plugin?

I am attempting to populate a QTableWidget by adding rows, this is done by the user clicking on the add button: I have the following code to try and insert rows but nothing is happening: def ...
2
votes
1answer
40 views

Create a layer in PyQgis with the same CRS as another

I want to create a layer which use the same CRS as another layer I already have in the project. The idea is to avoid the CRS dialog. I tried the things in this link: How to define layer's CRS and ...
3
votes
0answers
29 views

Loop distance point pyQgis

I have a .shp of lines where I'm able to calculate the sum of segments length but I'm trying to put a point at a given distance in meters. The problem is it puts a point at every segment. When I give ...
1
vote
0answers
29 views

Layer style is not rendered properly using PyQGIS

I'm trying to render a layer with the given .qml style into .png image using a standalone PyQGIS application. The issue is that not all the layers of the symbology are rendered, e.g. a polygon with ...
2
votes
1answer
42 views

How to connect QgsMapLayerComboBox to QgsDataDefinedButton

in Qt Designer there is the possibility to use directly QGIS custom widgets. In the UI I added a QgsMapLayerComboBox (to get the layers added in the legend) and a QgsDataDefinedButton. What I would ...
3
votes
1answer
45 views

Get QgsField alias in QGIS Python

In QGIS Python, how to get alias of field. In class QgsField, i can not find method to do this. lay = iface.activeLayer() provider = lay.dataProvider() fields = provider.getFields() for field in ...
4
votes
1answer
37 views

How can I optimize layer filtering using setSubsetString or QgsFeatureRequest().setFilterFids(my_indexes)

i'm developping a plugin (under QGis 2.8.1) for traffic assignment where I want to show the results of my simulation at each time step. Right now I'm using Time Manager plugin but it gets very slow ...
3
votes
1answer
45 views

Accessing Command line options passed to QGIS exe

I am using QGIS 2.8, I am passing the raster image along with the qgis-bin.exe from the command prompt. Is there a way to access the name of the raster being passed along the exe in my plugin?
1
vote
1answer
48 views

QGIS processing framework Python loading shapefile

I would like to write a Python script in the QGIS processing framework allowing the download of files from specific addresses. Instead of starting my script with: vectorLyr = vector I would like to ...
3
votes
0answers
62 views

Render Vector & Save as Raster

I am working with ENC files from noaa, specifically S57 format or ".000" to be as specific as possible. I am trying to render a layer or even the entire thing in a window but have had no luck. ...
2
votes
1answer
50 views

How do I use geometry object in processing.runalg()

I am trying to clip a polygon (large road network) with every row in another polygon (district polygon) using PYQGIS. layer_adm_level = QgsVectorLayer(base_path + adm_level + ".shp",'adm_level','ogr'...
4
votes
1answer
88 views

How to write Python code with QList class

I need to write an interpolation script for QGIS. I want use TINInterpolation method from Interpolation plugin. I found class in API documentation but I don't know how to write QList object with ...
0
votes
0answers
41 views

PyQGIS + Django Web Server — Not Working the Second Time Code Is Run

We are trying to create a standalone application on our local Django web server that uses PyQGIS to generate a series of maps based on a user's input. The user enters parameters on a web form and and ...
2
votes
0answers
27 views

PyQGIS: intersection of one node layer with two polygon layers

I´m new with the use of PyQGIS and I´m working in a problem applied to a water supply systems modelling, where I need to distribute the water demand in about 5000 nodes (network junctions). I´m ...
3
votes
1answer
33 views

How to keep live update coming from a WMS

I'm using a WMS that contain weather radars that is update every 10 min. I would like to know how to keep the map updating every 10min. I tried: from PyQt4.QtCore import * timer = QTimer() timer....
2
votes
1answer
53 views

How do I change the pixel values of raster data from QGIS python plugin

I have been trying my hand at a QGIS plugin. The plug in reads raster layer data into an array, pipes the data to a C++ program, does processing over there, and pipes my results back. After a couple ...
1
vote
0answers
37 views

How to incorporate QGIS custom widgets into plugin? [duplicate]

Developing a plugin with Qt Designer for QGIS 2.14.1-Essen on Windows 7 and having trouble inserting the QgsCollapsibleGroupBox widget. I receive the following error: ImportError: No module named ...
2
votes
2answers
48 views

QGIS Segmentation fault when manipulating QgsGeometry

So I am running QGIS 2.8.1 on Ubuntu 14.04. This following problem is happening in my script, but also occurs directly in the QGIS python console: lay = iface.activeLayer() lay.featureCount() 1L lay....
8
votes
1answer
196 views

Setting a default value in a QGIS field

I would like to add in a layer's field a default value. I mean, every time a new feature is created, that field would be automatically filled with the default value. In my case the default value ...
4
votes
1answer
71 views

Errror using the Simplipy QGIS plugin: 'QgsRasterLayer' object has no attribute 'selectedFeatureCount'

I am adding a raster in QGIS 2.14.1 and get this new error: AttributeError: 'QgsRasterLayer' object has no attribute 'selectedFeatureCount' I am not programming, just using a QGIS menu. I am using ...
1
vote
1answer
49 views

refresh programmatically created composer

I am trying to create a composer using pyqgis. Everything works as expected. The only difference compared to the manual creation of a composer is, that I am not able to update the layers (by pressing "...
0
votes
0answers
42 views

How to add dynamic text in standalone PyQGIS to reflect iteration of layer names

I am working with a standalone PyQGIS script below (that was given as an answer to How to iterate over layers and export them as PNG images with PyQGIS in a standalone script). The script exports the "...
3
votes
0answers
38 views

The features don't appear at the first time in my exported PDF

my problem consists of exporting to PDF format. The first time I run my code (Text Editor of QGIS) the PDF only has the legend. But the second time, it has the features. Changing the line of ...
4
votes
1answer
119 views

Bold and Italic layer labels with Python in QGIS

I'm trying to apply some labeling properties to a layer using Python. Everything went fine, except the way I tried to apply the Bold and Italic settings. Here is a part of the code: layer....
3
votes
0answers
58 views

Approach to controlling which layers display in a QgsComposerLegend

I've tried 2 approaches to control what shows up in print legends. Neither of them work which is troubling because other than pruning the layerRootTree in advance of composer.addItem(legend), there ...
1
vote
2answers
59 views

How to set the paper size to A4 for a PDF export with pyQGIS?

I have been developing this code, based on the official documentation of QGIS and some codes in gis.stackexchange. But my problem is that I don't know where to establish my height and width to make a ...
2
votes
0answers
28 views

addItem() method doesn't work [closed]

I show you my code, but basically, I have been following the steps in the official bibliography about Map Composition The code works, but I don't get the items I have been adding to the map (scalebar, ...
1
vote
0answers
25 views

I can't define “enum QgsComposerItem::ItemPositionMode ” to UpperRight

In order to create a new map layout with labels, I have to set in my code the position of the labels with ItemPositionMode, but it the parameter is not accepted: from qgis.core import * from qgis....
1
vote
0answers
24 views

QGIS cannot load macro function?

This has me stumped. For some reason, I can no longer run a function from a project macro even though macros are enabled (from Settings > Options > General > Enable macros > Always). Just ...
0
votes
0answers
39 views

How to georeference *.tiff to a given feature geometry automatically?

I´ve got the task to georeference an tiff image to the referencing polygon footprint (Polygon). I have found a lot of ways to do get the footprint from a raster but I could not find a way to use ...
4
votes
1answer
80 views

Can't delete features from layer using QGIS' Python API

I've only recently started using QGIS and it's Python API. Currently I've loaded two OpenStreetMap datasets. I would like to remove lines with from the second set where the name is already present in ...
2
votes
1answer
91 views

Create different print composers from different layers added to QGIS

I'm using QGIS 2.8.3 with windows 10. I want to know if it's possible and how to create, using python code, from each layer (in the table of content) a print composer to each one of them. Any ...
0
votes
2answers
61 views

How to connect push button in dock widget form?

Following this tutorial as a guide, I created a plugin using the Plugin Builder with the dock widget form. I am now trying to connect a pushButton to a function. The following is a snippet of code: ...
1
vote
1answer
45 views

Label only selected features with PAL PyQgis using an expression

I'm trying to label only selected features with an expression using PyQgis and the PAL functions, but I don't find any example and the API don't help me a lot (or I don't found it). My Qgis version is ...
0
votes
0answers
15 views

There is a Run Time error wile using the console.in QGIS

I was writing a post where I have pointed in my code which lines of code "make" QGIS to fail. But as the time as I was writing the post, I tested the code again in the Text Editor of QGIS (2.14). Then,...
1
vote
1answer
98 views

Writing result of PyQGIS to shapefile

I try to perform some zonal statistics on a shape- and rasterfile and write the output to a completely new shapefile! import sys # where is the module sys.path.append("/Applications/QGIS.app/Contents/...
2
votes
2answers
38 views

How to read the saved extent of the QgsProject?

I am trying to access the extent of QgsProject. How can i do that with PyQGIS?
2
votes
0answers
65 views

Problem using processing.runandload() [closed]

I'm writing a QGIS plugin using PyQGIS and I have a weird problem. When executing following line of code: processing.runandload("qgis:createpointsalonglines", r"Clipped", 1, 1, 0, r"memory:nodes") ...
4
votes
0answers
54 views

Issues updating field values programmatically for particular field data type on 64bit Windows computer using QGIS 2.8.7

I have an issue with a plugin for QGIS 2.8 I'm developing when using it on a Windows 64bit machine (as opposed to 32bit). I am trying to update values in a particular field in my plugin, and the ...
1
vote
1answer
65 views

Why does joining all layers in a group not work?

I am attempting to re-join all layers within a group to another layer ("Main.shp") outside of this group. The idea is for users to change values in one of the group's layers. As these layers are ...
4
votes
2answers
86 views

What's the correct syntax to use Processing gdalogr:merge from python?

I am using gdalogr:mergein Python console in order to merge to rasters (.tif) But I don't really understand the first parameter, where I have to put two variables. I get the following error: ...
4
votes
2answers
61 views

How to get layers in x number of subgroups?

I have a project which has dozens of groups and subgroups. E.g.: Main_Group > Sub_Group_1 > Sub_Group_1A > Layer_1A > Layer_2A How can I access ...
1
vote
0answers
43 views

Eclipse PyDev has quit recognizing QGIS objects

I followed the instructions for setting up Eclipse with PyDev to start creating QGIS plug ins found here: http://docs.qgis.org/testing/en/docs/pyqgis_developer_cookbook/ide_debugging.html after doing ...
0
votes
1answer
21 views

QGIS algorithm parameter: <ParameterString> [duplicate]

I have been working with the algorithm gdalogr:warpreprojectand have failed several times in the parameter in the title. Now, the problem is solved. It was about the EXTRA parameter. I read 3 books, ...