Python bindings for QGIS.

learn more… | top users | synonyms (1)

10
votes
0answers
295 views

PyQGIS save raster as rendered image, then use GDAL tools on it

I have tried to use the code from QGis Save Raster as Rendered Image. i is a raster layer: pipelayer = i pipeextent = pipelayer.extent() pipewidth, pipeheight = (pipelayer.width(), ...
8
votes
0answers
153 views

How to access a deleted features attributes (before committing)

I have a signal setup for a feature deletion event on a layer: self.layer.featureDeleted.connect(self.feature_deleted) When I try and grab an attribute from the deleted feature on the slot, a ...
7
votes
0answers
357 views

Performing buffering and intersection with script in PyQGIS

I wrote a script that performs the intersection of two layers: The first Layer -> layer1, represents the rivers The second Layer -> layer2, represents a set of circular dots distributed in a ...
6
votes
0answers
78 views

Development of a plugin which depends on an external Python library

I'm developing a Python plugin, the target is integrating into QGIS the functionalities of a PyPI Python library called 'elevation'. Is there an OS independent way of installing external Python ...
6
votes
0answers
108 views

Using memory layer as input and/or output with runalg?

Can a memory layer be used as an input and/or output with runalg? With runandload I get this to work: processing.runandload("qgis:mergevectorlayers","memory:bufferOne", "memory:bufferTwo", r"memory:...
5
votes
0answers
51 views

Sending a https request from a QGIS plugin using urllib2

I'm developing a QGIS plugin that needs to send https request to an API. I have to use urllib2 (see below if you want to know why I don't just use the requests package) The first request I need to ...
5
votes
0answers
57 views

See python script running while processing a task in QGIS?

Is it possible to see scripts running in Python Console - everything from tools and analysis vector to raster?
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 = ...
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 ...
4
votes
0answers
30 views

Qgis Python - Legends in Horizontal

I have successfully added legends in Map using Qgis QgsComposerLegend () python programming .(using Qgis python console) but legends are added vertically.I wanted to place legend horizontally. If you ...
4
votes
0answers
28 views

Parallel feature request connection limit

I have a large pool of feature requests that need to be performed on a PostgreSQL layer. Please assume that these requests cannot be joined into larger requests. If I spawn several threads to perform ...
4
votes
0answers
57 views

How do I implement PyQGIS multithreading to update a progress bar

I am developing a PyQGIS plugin using python. I facing a problem during the implementation of threading in my plugin. I have written a python script which contains a class wrapping all geo-processing ...
4
votes
0answers
611 views

How to stop a PyQGIS script that has an infinite loop, using the keyboard?

So i wrote a script that does what i want over and over again using a "while True:" in a certain time interval (every 5 seconds using time.sleep(5)). So far so good BUT when i want to stop it i just ...
3
votes
0answers
48 views

How to handle large tables in QGIS using python?

I'm currently writing a plugin that calculates values based on a QgsVectorLayer's attributes. To display and print the values I'm using a QgsComposerTextTableV2. I have several problems with my ...
3
votes
0answers
24 views

Zonal Statistics calculator differences between QGIS Lyon and Wien

I am trying to implement a process that uses the Zonal Statistics menu function. In Lyon, the menu that pops up had a field with a list of calculations, each with a check box. Here you can select what ...
3
votes
0answers
32 views

PyQGIS select layer by original table name

As far as I see, on QgsMapLayerRegistry.instance() there is a method to select layers: mapLayersByName(Qstring) and the method mapLayer(QString) respectively, wich accesses a layer by its id. ...
3
votes
0answers
58 views

QGIS canvas refresh & rendering control from plugin?

Plugin Description I have been working on a plugin which essentially doing the same as "GPS information" live tracking but with capability of displaying two GPS streams. I am comparing streams and ...
3
votes
0answers
61 views

How to integrate python-docx with QGIS

I have installed the newest QGIS and downloaded python-docx from this link python-docx . I haven't installed separately a different version of python. Is it possible to integrate this package of ...
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 ...
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. ...
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 ...
3
votes
0answers
59 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 ...
3
votes
0answers
72 views

Setting default label font in QGIS?

QGIS currently does not have a way to set a default font to be used for labelling, and being lazy I'm getting tired of having to set our house font styling for every layer I create or use (see change ...
3
votes
0answers
63 views

Gdal and module import error when creating an .exe application with pyinstaller

I’ve been struggling since three days in a row to create a windows executable application from my python application. I have managed to get results but I’m not at all satisfied with the workarounds I ...
3
votes
0answers
83 views

How to create a shapefile having Voronoi diagrams from the shapefile of an existing region?

I have a shape file of a region and I want to generate random sub regions of that shape file using Voronoi class of scipy.spatial package of python. But I am a newbie to GIS. I found out about Voronoi ...
3
votes
0answers
51 views

QgsSpatialIndex partial or complete overlap

I'm working on adding some functonality to a QGIS plugin. It currently uses a QgsSpatialIndex to efficiently compute whether the features of a vector layer intersect (potentially millions) of ...
3
votes
0answers
74 views

Python script to automate saving satellite images for different combinations of lat longs

PS. : This is my first try at a GIS application. Please forgive if my question is pedantic. I would like to get a series of satellite images all at the same scale centered around different points on ...
3
votes
0answers
132 views

Can qgis_core work with external python distribution (such as Anaconda)

I've built a python application that has its own GUI. I am trying to use qgis.core/pyQgis as map display only. Specifically, i have anaconda 2.3 and its python distribution (2.7.11). After research on ...
3
votes
0answers
83 views

How to show only selected features from a a layer in the QgsComposerLegend?

I have developed a custom qgis plugin. I have a button to export the map canvas in the form of image along with the legend. I came up with the following code for the legend: legend = ...
3
votes
0answers
97 views

spatial index intersection with qgsrectangle only computes polygones

I have the problem, that i only get polygon features inside my defined rectangle. If i switch off my polygon layer(s) i get my lines. TOC: Line-Layer on, Polygon-Layer on: i only get Polygons which ...
3
votes
0answers
64 views

PyQgis: Print Composer using input from several Spatialite-tables

How can I create PDFs out of QGIS using the Print Composer Templates that include a lot of text (from a text-template) and within the text several information comes out of my spatiallite-database. A ...
3
votes
0answers
77 views

How are costs returned by the pyQGIS implementation of Dijkstra calculated?

How are the costs returned by pyQGIS implementation of Dijkstra (QgsGraphAnalyzer.dijkstra) calculated? As far as I know, these costs correspond to the distance from the starting node to each of the ...
3
votes
0answers
54 views

Create and save composer with Python

With Qgis 2.8 I need to create some composers based ona template, and save them using Python. I've found how to load a template in a composition, but I do not find how to save this composition in the ...
3
votes
0answers
198 views

QGIS 2.8 Python Plugin Unittest Segmentation Fault 11

UPDATE: This issue may be isolated to my MacBook. The seg fault did not occur in testing on Windows. I have put together a sample unit test for a QGIS python plugin. It is causing a Segmentation ...
3
votes
0answers
165 views

How to change the group icon in legend via Python in QGIS 2.6?

How to change the group icon in legend via Python in QGIS 2.6? At version 1.x I did it this way: self.legendTree = self.iface.mainWindow().findChild(QDockWidget,"Legend").findChild(QTreeWidget) ...
3
votes
0answers
77 views

PyQGIS: standard and advanced linear referencing possibilities

I'm aware of the existence of the following QGIS plugins: QChainage Event layer linear referencing LRS Although, all of these tools offer some linear referencing capabilities, I find that they ...
3
votes
0answers
99 views

access point layer representation in qgis with pyqgis

I am exporting the style of a categorized point layer with qgis: unfortunately my code only extract the size of the symbol in the definition of the properties of the layer but not the ...
3
votes
0answers
164 views

PyQGIS: How to color raster layer with existing colorBrewerMap

With pyqgis I have added multiple new raster layers to the legendinterface(). Because i like the ColorBrewer style i want to color some of them with the "Spectral" gradient. How can I do this in ...
3
votes
0answers
184 views

Programmatically selecting features by polygon

Expanding upon this post how could you use QGis to programmatically draw a selection polygon and select features within the polygon? I have been using QgsMapToolEmitPoint(self.canvas), to find and ...
3
votes
0answers
180 views

How can I change the NoData value in QGIS 2.x using the python console

I'm trying to add a NoData value to a single band raster image in QGIS 2.0 using the python console but can't find the right bit of code to do it. Here's what I see on the console: >>> ...
3
votes
0answers
503 views

How to load the default layer style from Postgresql with Python?

I would like to write a python macro that upon opening my QGIS project file will reload the default style for each layer from the postgres 'layer_style' table. I have had a look at the documentation ...
3
votes
0answers
1k views

How to change feature's geometry?

Hy, I'm creating my layer like this: crs = core.QgsCoordinateReferenceSystem(4326, core.QgsCoordinateReferenceSystem.EpsgCrsId) uri = "Polygon" uri += '?crs=' + crs.authid() uri += '&field=...
3
votes
0answers
226 views

Setting border-style to 'no pen' using QgsGraduatedSymbolRendererV2

I am developing a QGIS plugin that, after a series of inputs, will produce a thematic map using the QgsGraduatedSymbolRendererV2. Because the polygon are very small, the boarders make it such that ...
2
votes
0answers
27 views

How can I change the origin (top left corner) coordinates of a raster using PyQGIS?

I am developing a python plugin for QGIS. The purpose of the plugin is to properly open an HDF5 dataset as a raster. Opening and displaying the raster can be done without the need for a plugin, ...
2
votes
0answers
22 views

Importing submodule with python for QGIS?

So I am probably missing something really obvious here, but for some reason, I can't import submodules in my python plugin. This is the general structure of my plugin: ├── __init__.py ├── metadata....
2
votes
0answers
20 views

Finding vectors with wrong direction in river network

I have a shapefile containing network of rivers for the whole country. The description of the layer is saying that orientation of the vector should be the same as the river flow. This is true for most ...
2
votes
0answers
42 views

QGIS Python Script - Python.exe Stopped Working

I purchased this book called Building Mapping Applications with QGIS and I am trying to work through one of the exercises. There is one script that I try to run that crashes python, generating the ...
2
votes
0answers
37 views

Making a pretty Base Map for QGIS and OpenLayers?

I am developing a standalone QGIS application as well a web GIS using Openalyers. Both applications use GeoServer published WMS and WFS services of parcels as a base layer. I was wondering if it is ...
2
votes
0answers
19 views

difference in behavior between merge from SAGA and merge from QGIS geoalgorithms

I'd like to know what I'm doing wrong with the merge algorithms in Python. I have several shapefiles (polygons) ending in 'LNA', 'LNC', 'LDA', and 'LDC', and I'd like to merge them depending on ...
2
votes
0answers
16 views

Unable to compile using make test(windows)

While trying to compile my test plugin I encounter this error. At the moment i can't figure out why it isn't working. I m using a windows and try to execute the command in OSGeo Shell. I typed in ...