Python bindings for QGIS.

learn more… | top users | synonyms (1)

0
votes
0answers
9 views

pyqgis, features geometry type changes to unknown after copying to anoter layer

Im copying a subset of features from a shapefile based QgsVectorLayer (polyline type shapefile) to a memory based QgsVectorLayer('LineString', layername ,'memory'): ...
0
votes
1answer
13 views

pyqgis write vector layer as tab delimited txt file

I'm using the following QGIS 2.8 Python code to save results to a txt file QgsVectorFileWriter.writeAsVectorFormat(inputLayer, "D:/dstest/my_csv", "CP1250", None, "CSV",True) I would like to be ...
0
votes
0answers
11 views

Identifying Left and Right Mouse Button Clicks in PyQgis application

I am relatively new to PyQt. I am trying create a custom plugin for Qgis which enables the user to select some features by drawing polygon on the canvas using mouse clicks and then performs ...
0
votes
0answers
31 views

Script in PyQGIS to create a shapefile

I'm having some trouble applying my Python skills to develop some scripts in PyQGIS. For me it's far simpler to write it in ArcPy, but then again I wouldn't get that much satisfaction after finishing ...
0
votes
0answers
7 views

Range problem in QDoublespinbox for different projections of data in QtDesigner\python

I have two QDoubleSpinboxes that updates the value of latitude and longitude of a point respectively. The data is in the CRS "EPSG:32643 - WGS 84 / UTM zone 43N" I had also set range of the ...
0
votes
1answer
26 views

QGIS Python Scripting permission denied

I've just started a Python Scripting tutorial on QGIS. The problem arrives right at the end, when I have to use this script: output_file = open('c:/Users/Ujaval/Desktop/airports.txt', 'w') for f in ...
1
vote
3answers
52 views

Is there any way to freeze the layer names in the TOC?

I would like to freeze the names of layers in TOC. Is there any way to do this via QGIS config or PyQGIS? I´m using QGIS Wien.
1
vote
1answer
27 views

fTool in pyqgis: Is it possible?

I am doing a work which I need to sample random points for many layers (classification of land use). Then, I'm trying to do a loop with my several layers and applied a functions of random pointos. I ...
1
vote
1answer
60 views

Logging layers openings?

i would like to log every layers openings in PyQGIS, regardless of the opened project. Is there a way to achieve that ? Where should be the Python code be located in that case ? Thanks for your help ! ...
0
votes
2answers
61 views

Create a script to add delimited text layer in QGIS

I'm trying to use QgsVectorLayer() function to add delimited text layer in QGIS. So I have a txt file (T_1999_1_2.txt) in path: "D:\PATRICIA\DOCUMENTOS\ESTACOES METEOROLOGICAS\DADOS METEOROLOGICOS\T" ...
0
votes
0answers
18 views

How to remove a QgsMapCanvasLayer from QgsMapCanvas with PyQGIS || C++?

I try to find a way to remove a QgsMapCanvasLayer from the QgsMapCanvas. At the moment I only can delete the MapLayer from the QgsMapLayerRegistry with: ...
1
vote
0answers
22 views

Adding Oracle Spatial Layer using Python Bindings of QGIS

I want to load a layer from my Oracle Spatial Database using the Python bindings of QGIS. I have tried loading the layer by creating the uri as shown in some previous posts. I am using the python ...
1
vote
2answers
31 views

How to add an image to canvas?

I am trying to make a QGIS plugin using Python. Right now I need way add an image to canvas but I don't want that image to be a new layer in qgis project. Is there a way to do it? Now I have: ...
2
votes
1answer
17 views

Unable to compile using make test in Linux

While trying to compile my test plugin I encounter this error, for the moment I can't figure out why, last week I had some issues on windows but eventually solved them via OSGeo Shell but this time ...
3
votes
1answer
32 views

Getting co-ordinates of current map canvas using PyQGIS?

I'm trying get the extents of the current map canvas. CRS is 22700 BNG. My code: canvas = iface.mapCanvas() print canvas vLayer = iface.activeLayer() extents = vLayer.extent() print extents ...
0
votes
2answers
67 views

QGIS and Google Streetview?

Is there a way to open an (embedded or not in QGIS...) window containing a Google Streetview view at given coordinates using PyQGIS?
1
vote
0answers
19 views

Setting up PyCharm CE 4 to work with PyQGIS library in Mac OS

I am trying to set up pycharm to work with pyQgis library but with not success till now. I am using PyCharm CE v4 and QGIS version 2.8 I have tried to implemnte the instructions of several posts like ...
2
votes
1answer
94 views

How to create and remove multiple QgsRubberBands in PyQGIS?

Currently the following code-snip works great to highlight a shape based on the 'feature' and 'layer' variables: self.rubberHighlight = QgsRubberBand(self.iface.mapCanvas(),QGis.Polygon) ...
1
vote
0answers
28 views

How to add diagrams to a layer in a PyQGIS standalone application?

In my standalone application, I show different layers based on queries into a canvas. Now I want to add a layer with charts over by the values of an attribute. Is it possible in a standalone ...
2
votes
0answers
39 views

Is it possible to use memory layers in QGIS processing algorithms?

I am building a QGIS plugin that connects to a MySQL database in the local network, and then adds a subset of one of the tables to an in-memory layer; the subset is based on data currency (only taking ...
1
vote
1answer
93 views

Can we avoid using SIP library when writing standalone QGIS python script

I wanted to write a small custom python script using QGIS functionality. So I started with the QGIS documentation on the custom application section. After having some troubles with the import ...
1
vote
1answer
36 views

pyscripter : add a legend to my vector layer

I work on PyScripter, i managed to display a vector layer from Postgresql with a symbology. But I have a difficulty to display a legend. def main(): def init(): # appel de l'application et ...
2
votes
1answer
29 views

Multiple ComposerMap items not rendering properly Pyqgis

I am currently trying to put together compositions using inputs from two different map canvases. One is from a canvas built and controlled via a plugin, the other is the the main QGIS canvas (accessed ...
0
votes
0answers
23 views

Save Print/Map QGIS composer view as PNG/PDF using Python (without changing anything in visible layout)?

I have a QGIS composer/print view opened with all elements adjusted as I wish. Now I need to print/save/export this as a PNG or PDF file from Python console/Python script. I do not want to change ...
1
vote
1answer
72 views

PyQGIS - load PostGIS layer as editable

I can load a PostGIS layer on QGIS' map canvas but "Toggle Editing" button comes "inactive". How can I load vector layer as editable? The code given below loads PostGIS layer on map canvas & ...
1
vote
0answers
28 views

Create a checkbox per loaded layer in a QGIS plugin

I want to create check boxes inside a listview in my plugin dynamically based on the number of layers loaded in QGIS. I would like to know is there any similar existing plugin in QGIS so that I may ...
1
vote
1answer
53 views

How to get path for layers listed in a combobox?

I want to get the path of a layer in my plugin, in the console it works fine but in my plugin it gives me the error AttributeError: 'NoneType' object has no attribute 'dataProvider' def run(self): ...
2
votes
1answer
46 views

How to display a picture in QGIS custom form?

I'd like to integrate an UI file as a form in QGIS 2.8. The UI file is created in QT Designer. One of the attributes in the attribute table is a filepath to an image. I'd like to display the picture ...
1
vote
1answer
52 views

How to remove “ERROR 1” messages from a standalone QGIS script?

I am running a standalone script for QGIS which creates a high resolution grid and clips shapefiles onto it. Works perfect if the cell width and height have a high values (in my case, >200m for both). ...
2
votes
2answers
85 views

How to load a raster layer using PyQGIS?

I need to load a raster file from the provided file path. I wish to use it further in the Raster Calculator. I wrote a function which converts string (I assume it is a file path) to a raster object. ...
1
vote
1answer
67 views

PyQgis, styling vector layers in different canvas

I'm developing a QGIS plugin and I need some help with styling layers in different canvas objects. In my dialog window I've got two QgsMapCanvas objects canvas1 and canvas2. Layers from registry are ...
1
vote
0answers
42 views

Displaying symbology outside map canvas window extent?

Say we have equally distributed x,y mesh vector file. Each coordinate has a map-unit based diameter circle symbology. If we zoom into a region of the map canvas far enough, some centroids exist ...
2
votes
1answer
53 views

Tool Bar visibility in PyQGIS

I am creating a plugin for Qgis 2.6 and when my plugin loads up i want to disable the visibility of some of the tool bar. I was able to set the visibility for various tool bars like ...
1
vote
1answer
56 views

How to make a Standalone QGIS application run as an exe file

I had made a simple standalone application and that works fine. But the user have to execute a batch file(inside in which I had set the QGISHOME path, Python path and call my main python file) to run ...
1
vote
1answer
17 views

How to make the toolbar icon visible in the target machine without changing the path

I had done a simple standalone application that loads a shape file and does some basic actions like zoom in, zoom out, pan etc in the viewer. In my python file, I had set the icon path for all these ...
2
votes
1answer
143 views

Standalone script looping incorrectly?

Following on from my previous question, I would like the script to do the following (includes illustration): Search for the first shapefile (Paris (O).shp) in Country_France > Original files and ...
1
vote
0answers
32 views

PyQgis: Load qlr files

I have a plugin that loads a Raster image and selects the correct base maps to use. The Raster image load with no problem, but my base maps will not load. I have create a qlr, which has 5 references. ...
2
votes
1answer
44 views

Viewer not displaying the data in my standalone PyQGIS Application

I tried creating a standalone external application of QGIS using python and I followed the tutorial mentioned in the link ...
0
votes
0answers
34 views

pyqgis - refreshing only QgsMapCanvasItems not the entire QgsMapCanvas

I have a fairly complex map, consisting of many layers, and despite they're optimized, they still take a certain time to refresh. I also have a QgsMapCanvasItem representing my position, which i would ...
1
vote
0answers
21 views

Select features intersecting a linestring in QGIS

I wrote a python plugin that grabs all (vector, linestring) features between two points on the map. At the moment, I select all features intersecting the rectangle around these two points, and then ...
0
votes
1answer
53 views

Standalone External QGIS Application using python [closed]

I am creating a standalone external Application of QGIS using python and i am following the tutorial mentioned in the link ...
0
votes
1answer
43 views

pyQGis scale based visibility problem

Im loading some layers from postgis using pyqgis in my standalone qgis app. For each layer i also load a style using: lyr.loadNamedStyle("style.qml") I've setup 2 versions of styles in qgis ...
2
votes
1answer
46 views

PyQGIS: subtracting two values and append ID to list

I would like to subtract two values retrieved from qgs feature iterator objects and append the value of the feature id to a list depending on a condition. I have two layers: roadsLayer pathsLayer ...
1
vote
1answer
51 views

How to remove a layer and its legend in a standalone pyqgis application?

In continuity in my question "How to add a legend to a canvas in a standalone PyQGIS application?" > In every addition of a new layer in my standalone application, the legend lengthens and becomes ...
1
vote
0answers
24 views

PyQGIS - Syntax for importing WKT file

I couldn't find any proper example of how to import a .csv with WKT coordinates (Polygon) in PyQGIS. Here are more details on my .csv. I am working with polygons. The delimiter is a semi colum, and ...
0
votes
1answer
35 views

Problem calling qgis2leaf outside the QGIS

I am a computer programmer starting with PyqGis-Python, and I’d need to automatize the creation of a webmap using the plugin of qgis2leaf from a QGIS Project. I have reached to call “import ...
0
votes
0answers
19 views

Multi Label with Multi Placement

is there any way to add multiple label at different placement in qgis. Suppose I have a vector layer for line geometry and my attribute are name and route number. Now i want to add the route number to ...
2
votes
2answers
129 views

How to use `layer.getFeatures()` in a standalone script?

I am following the QGIS Cookbook and this post where it concerns reading attributes from layers. I would like to exploit this method and implement it into a standalone script. Essentially, I want to ...
2
votes
1answer
50 views

use gdal python bindings from the QGIS folder in a custom script

I have QGIS installed (on Windows) and can import this line from the QGIS Python console: from osgeo import gdal When I try the import in a python file it doesn't work Traceback (most recent call ...
1
vote
0answers
86 views

Buffer Csv gets repeated when more than one feature is selected in mapcanvas in PYQGIS

I have a function which will allow the user to select a feature or more features in map canvas and performs buffer for the selected feature(s) and writes the output to a csv file. I dont have any ...