Python bindings for QGIS.

learn more… | top users | synonyms (1)

0
votes
0answers
17 views

sorting list by multiple criteria and grouping alphabetically in python (PyQGIS)

I have a list named "lsNearCities" which contains "states" and "cities" in it. And I write the values in the list to csv where the column will be in the order of city and state. And also I did sorting ...
2
votes
1answer
34 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
33 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
15 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
130 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
21 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. ...
1
vote
1answer
28 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
20 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
11 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
37 views

Standalone External QGIS Application using python [on hold]

I am creating a standalone external Application of QGIS using python and i am following the tutorial mentioned in the link ...
0
votes
1answer
29 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 ...
1
vote
1answer
37 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
32 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
20 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
26 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
14 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
105 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
41 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
38 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 ...
3
votes
2answers
104 views

How to add a legend to a canvas in a standalone PyQGIS application?

I am trying to develop a standalone PyQGIS application. The map display does not pose any problems, but I do not know how to add a legend to the canvas.
1
vote
1answer
46 views

How can I get features that satisfy a QgsExpression using PyQGIS?

I have two fields say "State" and "name" which would be get from the two comboboxes. After which, based on the current text in the combo box, I want to make QgsExpression and feature that satisfies ...
0
votes
1answer
43 views

How to access shapefile m-values with pyqgis?

Does anyone know how to access (read/write) m-values of a line-shapefile using pyqgis? I know how to do it with arcpy cursors ...
0
votes
0answers
27 views

Is PyQt4 'drag and drop' functionality available in Qgis Plugins?

In Qgis 2.8, is it possible to use the PyQt4 drag and drop classes (dragEnterEvent, dropEvent) to interact with items from a qtreeview, in a Python Plugin? Is it possible to hook into the ...
1
vote
1answer
31 views

How to implement Add feature action from PyQGIS

I'm trying to implement / reuse Add Feature functionality in my python plugin. there a class/function that handles geometry creation on canvas based on layer geometry definition? I'm checking API but ...
1
vote
1answer
30 views

Using 3rd party libraries on QGIS (Windows)

How can I use 3rd party libraries on QGIS plugins on Windows? I've developed a plugin that uses rasterio and numpy for a customer, but he's having problems installing rasterio and numpy. Actually ...
2
votes
1answer
87 views

Select by location in Python

I have a polygon layer and a point layer (with coordinates for each point). The polygon layer got created using the MMQGIS PlugIn (Hexagonal Polygons). I want to select all the points inside each ...
3
votes
2answers
80 views

Using folder wildcards to copy files with Python

I would like to copy the data of one specific shapefile from a specific folder ("Grid") to a number of folders containing the name "Country". The country shapefiles would keep their original name. ...
0
votes
2answers
47 views

Extract Elevation of Points from DEM using Python QGIS or GRASS

I am utterly new to GIS, so please bear with me if I am providing incomplete information here. I have a DEM file (.dt2). What I am looking to do is as follows: take a series of points specified as ...
2
votes
1answer
37 views

Not able to load any Raster File using QGIS Python

I am trying to run an elementary piece of Python code, that simply loads a dem file as a raster accessing the QGIS Python API. On the embedded console (within the QGIS application GUI), it runs fine ...
1
vote
1answer
29 views

Rename output shapefiles in PyQGIS

I have a shapefile which resides in a folder, gets processed and the output is saved in another folder. Before the output, I would like to rename the shapefile slightly differently from the original: ...
0
votes
1answer
44 views

polygonize giving duplicated polygons

I am trying to reproject some ascii files and convert them into shapefiles. I am new to python but looking at some code online and help files I was able to write the following code to run on Python ...
0
votes
1answer
40 views

Script not processing shapefiles from one folder to another

I am working on a script which takes shapefiles from one folder called "Original files", process them and then output the results into another folder named "Processed files. I asked a question on how ...
1
vote
1answer
62 views

differences in distance between shapely and geopy

I am getting totally different distances from shapely and geopy. On one hand - it makes total sense, shapely measures on a plane and geopy measures on a spheroid. But the differences are so dramatic, ...
1
vote
1answer
36 views

Rename layers with script

Just discovered Qgis and really impressed! I've not formal GIS training so rely on Google to figure stuff out. I'm using the SHP files made available by the Canadian Government as part of their ...
1
vote
1answer
68 views

Where is the python library of QGIS 2.8

where is the Python library for QGIS 2.8 on a mac (10.10)? I cannot find it... sys.path in the QGIS python console gave me some path, but where the interesting part is happening it replaces the ...
3
votes
1answer
144 views

Programmatically grouping multiple layers into separate groups using QGIS?

I'm trying to group a large number of layers together based on a common portion of name string. They are a mix of polygons and points. I would like to create individual groups by using part of the ...
1
vote
1answer
33 views

Multi-Ring Buffer Methodology

When creating a multi-ring buffer I see two methodologies: Create buffer around feature, buffer the resulting buffer, and repeat for as many rings as required. Using the initial feature to create ...
-4
votes
0answers
43 views

Creating Check Boxes for all the Layers displayed inside the List View

I have a List View in my UI. Inside which I would like to display the layers loaded in my QGIS toc. For each layer in List View, it should automatically create checkboxes for all layers. How this can ...
1
vote
0answers
88 views

Qgis 2.6 and 2.8. Custom form and Init function

I try to apply the good tutorial written by Nathan "Custom feature forms with Python logic". I try his sample on qgis 2.6 and 2.8. I altered the sample to allow field initialization by setting ...
0
votes
0answers
27 views

Reading/writing utf-8 encoded data using Fiona?

So I have a 'cpg' file with my 'in_file' shapefile data (definitely set to 'utf-8'). I was using 'meta' to create the same schema/crs as 'in_file'...though it runs, my text fields are borked on ...
0
votes
1answer
45 views

Problems with Geometry collections. (Fiona: write output of Multipoints and Points)

Updated: I am getting the following error on this function: ValueError: Record's geometry type does not match collection schema's geometry type: 'Point' != 'MultiPoint' The problem is that I have ...
1
vote
1answer
29 views

Can you change the layer name of an output vector from a processing script in QGIS?

I define an input csv file and an output like so in my processing script: ##Input_CSV_File=file ##Output_Shapefile=output vector The output shapefile is added to the map automatically when the ...
1
vote
0answers
33 views

Something changed in QgsVectorDataProvider().changeAttributeValues() in QGIS 2.8?

I have a plugin that works with QGIS 2.2 but does not work with 2.8. Only deleteFeatures() works fine, but changeAttributeValues(), changeGeometryValues() and addFeatures() not. I receive r == False ...
1
vote
2answers
35 views

Writing PyQGIS Output to Shapefile

I'm trying to find the closest point on a line to another point as in this post. However when I try to write the result as a shapefile I get an error: TypeError: ...
0
votes
2answers
49 views

How to measure distance using shapely

Reading the documentation...it looks like I should have this right, but I don't. The example is: Point(0,0).distance(Point(1,1)) 1.4142135623730951 Based on this example I wrote this block ...
1
vote
0answers
46 views

While loop in QGIS modeler

I am looking for a way in QGIS - preferably using the graphical modeler but console scripting will also do - to build a model that iterates through features of a given layer until a condition is met - ...
1
vote
1answer
45 views

How to call 'shapely' .coords on a fiona filtered list?

I have to filter a shapefile by attribute then compare it to another shapefile using .coords...however I am a bit perplexed how to do this as my filter is returning a list type...(and .coords requires ...
0
votes
1answer
29 views

Behaviour of Select Feature by Freehand tool in my own plugin

I am calling QGIS "Select Feature by Freehand tool" in my plugin. what it will does is it allows the user to select features in mapcanvas and i made a signal like if selection changed in mapcanvas , ...
1
vote
1answer
46 views

No expected output when accessing variable from one function and using in another fucntion

I have a function say selectedfeatures this function would be called when a selection changed event happens in mapcanvas. self.canvas.selectionChanged.connect(self.selectedfeatures) ...
2
votes
1answer
43 views

How to define an event for features selected in mapcanvas in qgis using python

I have created a push button, when it is clicked it calls the function 'selectfeatures'. This function will call the Select feature by free hand tool of QGIS and allows the user to select features in ...