Python bindings for QGIS.

learn more… | top users | synonyms (1)

1
vote
0answers
13 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....
0
votes
1answer
16 views

Dynamically move map canvas and main window using PyQGIS

I am trying to create plugin that will open new window with some layer, Dynamically "pan" my window, when main window is pan. So boundingbox coordinates should be the same in both windows. I need new ...
2
votes
0answers
14 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
1answer
38 views

Python to create new fields in many layers / QGIS

I have a number of line layers on which I need to perform the same task: add 4 columns with the start and end points of each line. The expressions that I use to do this are: $xat(0) $xat(-1) $yat(0) ...
1
vote
0answers
12 views

How to implement a Plotting widget into already existing PyQt4 Interface

I am using Python, PyQgis for about one week and already built a plugin for GIS 2.14 which is -so far- working pretty well. As my next step I want to add a widget to plot data to my already existing ...
1
vote
1answer
31 views

How to connect QtDesigner with python console on QGIS

I've created a script with python console on QGIS and an interface for my plugin with Qt Designer with QGIS 2.14.0 custom widgets. I would like to connect my sript with the interface but I can't find ...
1
vote
0answers
22 views

QGIS: startup.py executed twice?

To test something I have a very simple startup.py file in my .qgis/python folder: import qgis qgis.utils.iface.actionShowPythonDialog().trigger() print "Welcome chump" Python console launches fine,...
0
votes
1answer
23 views

Invoking QGIS style dialog from Python standalone script

I can load a layer, open a canvas, and draw the layer in the canvas using the Qgis python API. Can I bring up the properties dialog, or even just the "Style" tab of the properties dialog, from such a ...
2
votes
1answer
33 views

Trouble using “Clip Raster by Mask Layer” algorithm QGIS

I'm having issues using the "Clip Raster by Mask Layer" algorithm to clip a raster by a shapefile. When I run the algorithm, I get an error saying that the mask layer could not be loaded, even though ...
3
votes
0answers
19 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 ...
0
votes
0answers
29 views

How to use Qt3 Support widgets in QGIS plugin?

Similar to this post: My plugins crashes with “No module named qgsprojectionselectionwidget” in Windows. Except I would like to also use Qt3 Support widgets (in particular, a Q3GroupBox). However, ...
3
votes
1answer
32 views

Unable to create field for PostGIS layer. PYQGIS

I'm having some troubles to create a new field in a postgis layer.This is the code I'm trying to use, but nothing happens, no field is created: from PyQt4.QtCore import * dbnam = "pruebapython" uri =...
3
votes
1answer
55 views

QGIS Symbol Categorisation

layer = iface.activeLayer() # get unique values for 'severity' field fni = layer.fieldNameIndex('severity') unique_vals = layer.dataProvider().uniqueValues(fni) # define categories to use in ...
0
votes
0answers
32 views

QGIS Custom Query Plugin

I am very new to QGIS plugin development. Is it possible to create a custom form (Field will be fixed and User can select only operator and enter value for field) to do custom attribute expression ...
1
vote
1answer
27 views

runalg('qgis:union', layer1,layer2,output) PYQgis

I need to use qgis:union in pyqgis algorithm and to merge 2 layers, layer1 and layer2 and "see" the output layer But i don´t understand how to work with the "output layer" this "output layer" have ...
1
vote
1answer
13 views

Print a centered map from a QGIS project for each point in a shapefile

I need to produce on the order of 100 maps that are centered on each point of interest in a shapefile. I would like to prepare all the layers in a master QGIS project, and set up the composition for ...
2
votes
1answer
32 views

if __name__==“main”: in standalone Python script for QGIS

I am working on a standalone Python script for loading shapefile layers into an application window with my central widget being canvas. The previous code I had written is almost identical to the code ...
1
vote
1answer
22 views

Running QGIS Python code from the R rPython package

The following script works fine from python or ipython at the command line: from qgis.core import * from qgis.gui import * import sys sys.path.append("/usr/share/qgis/python/plugins") from PyQt4....
2
votes
1answer
27 views

Adding a WMS layer in QGIS using python

I'm trying to write a python script to load the Environment Agency (EA) Flood Zones WMS layers into QGIS (2.14). I've provided a link to the EA's data catalogue at the bottom of this question. The ...
1
vote
0answers
26 views

Autofill fields of pyQgis script

I have three fields of output vector layer in Qgis script: ##output_vector_first=output vector ##output_vector_second=output vector ##output_vector_third=output vector When user fill first field I ...
3
votes
1answer
29 views

AddRaster using pyqgis

I am able to attach a raster by using python console using the command shown below. qgis.utils.iface.addRasterLayer('D:/Work/dt0017810q.tif') But, when the same image/raster path is read from a ...
0
votes
1answer
22 views

Access actions of ToolbarMenu/PanelMenu using PyQGIS

For a python plugin I need to remove/disable some UI elements so that they can't be accessed by the user. Thus, I removed the respective actions, toolbars and menus from the interface. However, in ...
1
vote
1answer
25 views

Algorithm not found

I'm trying to combine shapefiles in a folder of mine, but everytime i run it or run a variation of this it gives me the same error, "Error: Algorithm not found" this is my code: import os import ...
2
votes
0answers
39 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
1answer
50 views

How can I trigger a QGIS plugin Event from map refresh?

I have a combobox in my plugin (python Qt dockable widget) that needs to contain the currently open rasters. How do I trigger an update of the plugin when something new gets added to the map?
1
vote
1answer
23 views

Add layers to Spatialite Database using PyQGIS

I would like to add layers into a spatialite database. I have used the QgsVectorFileWriter method: parcDisSHP='/xxx/xxx/xxx/xxx/FILE.shp' parcelasDis = QgsVectorLayer(parcDisSHP, 'Parcelas_Unicas', "...
2
votes
1answer
43 views

Plugin for fast export selected features from multiple layers

Is there any tool or plugin providing export of selected features from more than one layer on one click? I need to create multiple exports from three layers. Feature from layer one, then feature from ...
4
votes
1answer
81 views

How to load multiple vector layers into QGIS' map canvas using python scripting?

I am trying to write a standalone script in python to create a QGIS map canvas. The vector layers I am attempting to load are Shapefiles. Currently, I am able to load each vector layer, add them to ...
3
votes
1answer
32 views

QGIS geoprocessing script, ## hand-over processing-specific information error

I have a QGIS python geoprocessing script starting like this: ## Networking = group ## lIn = vector ## lOut = output vector from qgis.core import * v = processing.getObject(lIn) #[...the rest...] ...
2
votes
1answer
65 views

How to get attribute values from vector features visible in the qgis canvas

I have a vector layer (grid). Currently I select some tiles with the select tool and paste some python code to get information about these features. layer = qgis.utils.iface.activeLayer() ...
2
votes
0answers
40 views

problem using qgis spatial join in a python script or modeler : no results [closed]

I'm trying to create polygons from points layers. Each layer contains one point to avoid troubles due to superposition of polygons. I detailed the context here : How can I add output vector to a list ...
1
vote
0answers
52 views

Cannot run QGIS algorithm with python script without interface

I'm trying to run the QGIS 'intersection' algorithm from a Python script: (Working with Ubuntu) #!/usr/bin/env python # -*- coding: UTF-8 -*- import sys from qgis.core import * from PyQt4.QtGui ...
1
vote
0answers
20 views

Merging Shapefiles in a Folder using pyQGIS [duplicate]

I was reading the QGIS Python Programming Cookbook (page 74) trying to learn how to merge shape files because I need to do it for what I'm doing. I was using their example just to try it out though. ...
2
votes
1answer
24 views

How to include QgsRasterBandStats in plugin

I'm making a plugin were i want to get the min and max value of a raster. When i tried the following code in the qgis python console it worked fine but in my plugin code i get the following error ...
1
vote
1answer
34 views

Create Vector Grid from a features Extent with PyQGIS [duplicate]

NOTE: THIS IS FOR QGIS 2.14.1 and uses VectorGrid instead of CreateGrid also though the question How to generate a grid programmatically in Python without GUI? is answered fantastically the PyQGIS ...
2
votes
1answer
51 views

How to remove all layers from a group

I want to remove all layers from a distinct group. root = QgsProject.instance().layerTreeRoot() the_group = root.findGroup("my_group") parentGroup = the_group.parent() I think I have to loop 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
18 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 ...
5
votes
0answers
48 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 ...
2
votes
0answers
43 views

PyQgis does not load a vector layer to form

I will want create "Hello World" project at PyQgis. I will want to show map on form.ui from .shp-file, but it does not download and show. But it is not loaded and does not appear. It`s value ...
2
votes
1answer
50 views

How to create a QgsFeature with default attributes?

I have a polygon layer loaded from POSTGIS database. This layer has a default value for the first column. I can create a new feature set that attribute to some predefined value with newFeature = ...
1
vote
0answers
26 views

QGIS Batch Processing error: AttributeError: 'NoneType' object has no attribute 'update'

I receive the following below error when trying to run Batch Processing in QGIS. I have tried uninstalling QGIS but still this problem persists. An error has occurred while executing Python code: ...
3
votes
1answer
75 views

get log of internal functions called by qgis

Is there a way to know which internal python functions are used by QGIS? e.g., when I click on "add vector layer" button I would like to know the functions that are called by QGIS. It would simplify ...
2
votes
1answer
28 views

Load postgis vectorlayer with AuthConfigId

I've tried to add a postgis-vector-layer in qgis 2.14.0 by using authentication (authConfigId) and PyQGIS. When running the script I'm asked to login by username/password instead of using ...
1
vote
1answer
48 views

How to filter out layers with QgsMapLayerComboBox?

I am using Qt Designer 4.8.5 to develop a plugin (with QGIS 2.14.3-Essen). I recently started to use QgsMapLayerComboBox widgets instead of the conventional Combo Box widget. However, I want to ...
3
votes
1answer
65 views

Add field and calculate expression with PyQGIS

I want to use PyQGIS to add a new field and calculate the values for each feature. Similar to Field Calculator option. My 'Field Calculator' expression is for example: y(start_point($geometry)) from ...
1
vote
1answer
54 views

How can I add output vector to a list to loop a geoprocessing on it?

I have about 18000 circular buffers that I want to transform in some kind of a wind rose. To do this, I transform the buffer polygons to lines, create points along the lines on the wind directions ...
1
vote
2answers
49 views

Rpy2: how do I use the function 'as' (r library methods) in python?

I want to coerce an object of class Raster Layer to class SpatialPixelsDataFrame since that is required as input for the function autoKrige from the r library automap. However, when I try to use as ...