Python bindings for QGIS.

learn more… | top users | synonyms (1)

2
votes
1answer
34 views

Search Shapefile and return Extents

Looking to convert this Arcpy script to pyQGIS. I sure Hope pyGIS has an user input that works outside the command line. # make custom button to search Parcels by Parcel Number # and zoom to selected ...
2
votes
0answers
187 views

Import processing module from QGIS into Python Window of ArcCatalog?

It is possible to import processing module from QGIS and run it in Python Window of ArcCatalog? I tred in qgis import sys output = sys.path and copy output to arcgis console: import sys for x ...
1
vote
1answer
48 views

Editing multiple layers using QGIS?

I'm wondering how to edit multiple layers, maybe standalone. I have 2 shapefiles. 1 line and 1 point What i want is the following: When i select a line, then the line and the point shape has to go ...
0
votes
1answer
470 views

ImportError: No module named qgis.core from PyQGIS?

Trying to load QGIS -- I have a working copy of Python: 2.7.9 -- It looks like QGIS is not finding PyQGIS. I am aware that this is a problem with the PATH but do not see how to fix it. > My ...
5
votes
1answer
290 views

Extent problem in PyQgis

I'm trying to set the extent of a square feature to the canvas, that works in QGIS, but when I print the canvas into a PDF, it always gives me some empty area, below is the screenshot of QGIS canvas ...
1
vote
0answers
56 views

Populate empty attribute table from constantly growing CSV in QGIS

I have a Python script running that will generate a line feature from a point depending on a degree of rotation around that point. I have a non-spatial CSV setup to get fed this rotation data from ...
2
votes
1answer
106 views

Getting list of QGIS field names, not including hidden fields using PyQGIS

Currently, for a python plugin for QGIS 2.8.3, I get the list of fields for a layer using pendingFields as mentioned in this thread: fields = self.layer.pendingFields() I now have a few hidden ...
2
votes
0answers
45 views

PyQGIS reference to QGIS plugin UI in Travis unittest

I want to get unittesting under Travis to work with qgis2web. It works up to a point, but Python access within the plugin to the plugin's own UI seems not to be working. The unittest I am working on ...
1
vote
0answers
94 views

How to view the features of a point with a click in QGIS

I am developing a plug-in for QGIS. I am creating a form of personalized editing using QtCreator. The form is in the following image I read a csv file and when i click in a button OK I get a layer ...
4
votes
0answers
88 views

How to load layers from postgres using SELECT statement?

I am trying to load a postgres table (columns extracted using a select statement) from the python console in QGis: The following works fine and the layer loads as expected: uri = QgsDataSourceURI() ...
1
vote
1answer
85 views

How to update the attribute table in layer from dictionaries using python

I have dictionary with the values: dict = {0L: {'val1': 60, 'val2': 199, 'val3': 7.719},1L: {'val1': 60, 'val2': 199, 'val3': 7.719}} I want to update these values in the attribute table of a ...
1
vote
2answers
35 views

Putting result of selection of plots in frame of QGIS?

I have made a plugin for QGIS in pyQt. Then I can make a query from a PostGIS database and I get the plot or bunch or plots results of that query in a layer. This layer is overlapped on the top of a ...
2
votes
1answer
76 views

pyqgis traversing subgroups and group layers

I am trying to find the name of subgroups using pyqgis. I have been trying to use Playing with subgroups I am however unable to traverse and get the names of the subgroup. I have tried the code on ...
1
vote
0answers
100 views

WKID issue when adding raster layer from ArcGIS “mapserver” to QGIS via REST

QGIS docs here describe how to do this. I am trying to add a layer from this MapServer: gps.digimap.gg/arcgis/rest/services/JerseyBaseMap/MapServer When I try the following command from the Python ...
3
votes
2answers
152 views

pyqgis add a picture

I am looking for a way to add a picture to my map using pyqgis. Are there any examples of how to do this. I know it can be done using the classQgsComposerPicture. I am not much of a programmer so I ...
1
vote
1answer
171 views

Move feature in front

Is it possible to move feature in front of another? If I have smaller polygon and I draw larger polygon over it, is there a way how to move the smaller one in front? Is it possible in QGIS or better ...
3
votes
1answer
96 views

QgsExpression using complex sql and python subsitution

I have a sql statement i am running in postgres fine and would like to transfer it to a QgsExpression mainly because I have loaded the layer in Qgis. My sql is: select column a,column b from table1 ...
1
vote
1answer
107 views

How to calculate the raster statistics with polygon layer using numpy and scipy in python?

I have used zonal statistics from processing to calculate the raster statastics with polygon layer. processing.runalg('qgis:zonalstatistics', rlayersource, 1, vlayer, None, True, Path) But this is ...
4
votes
1answer
391 views

Showing only some layers in QGIS legend?

My QGIS 2.8.2 standalone app provides several decorating layers (e.g. cartographic grid, background layers, reference points) which should be not changed by the user (neither editing nor hiding), as ...
2
votes
0answers
61 views

How to display selected features in a map to exporte as PDF

I've already managed to select feature by ID in a layer and zoom to it using pyqgis. The canvas considered this changes but the map that I exported as PDF do not consider this changes, any idea to ...
1
vote
1answer
210 views

How to find the intersection length between two polygons using python

I have two polygons and i want to find the intersection line length between these polygons. for geom1,geom2 in itertools.permutations(selection,r=2): intersection ...
2
votes
1answer
327 views

How to create a valid QgsVectorLayer from delimitedtext?

I am having trouble loading csv files into layers using QgsVectorLayer(). I know this looks like a repeat, but I have carefully read Create a script to add delimited text layer in QGIS and ...
1
vote
2answers
180 views

Set color to polygons

I need to color each polygon based on its area and length. I can loop through all polygons, find out their area .geometry().area() and if it is larger than 100 meters squared, than I want it to be ...
1
vote
1answer
192 views

Checking layers with scale based visibility for visibility in QGIS

I am writing a Python method which I want the mouse click event to connect to. The method selects objects from layers that satisfy certain conditions. I want to select from any visible layer, that has ...
2
votes
2answers
75 views

How to load stored composer from project file in standalone QGIS application?

I would like to load a .qgs file and get a composer from it, but I can't figure out how. Is there a way, or do I have to read the xml myself and individually set the appropriate values for the ...
2
votes
1answer
96 views

Align and reshape polygons based on surrounding polylines

I am trying to use a shapefile with polygons and I am trying to align it to a road network, that the polygons align themselves to surrounding streets. Is there a way to automatize alignments between ...
1
vote
2answers
235 views

How to show variable values in message bar in QGIS?

I know that I can write custom text to message bar with the QgsMessageBar.pushMessage() method. But if I understand the documentation right, there's no room for variables added to a string where they ...
1
vote
1answer
64 views

How to register a broadcast on QGIS to start my plugin on start after loading plugins

I want to perform a default task when user opens QGIS but here I am building it as a python plugin so I want a signal or broadcast to call my plugin. I didn't build QGIS from source my plugin should ...
2
votes
0answers
111 views

Multiprocessing in python qgis?

When i try to do mutliprocessing in python Qgis it doesn't work from multiprocessing import Process,Lock import multiprocessing def name1(l,i): print i if __name__=='__main__': lock=Lock() ...
2
votes
1answer
243 views

Remove inner rings from QgsGeometry polygon in QGIS Python

I am a QGIS python user. I want to iterate over the rings of a polygon to remove holes in the polygon, so: I need to iterate over the rings in a QgsGeometry polygon I need to detect the main ring ...
1
vote
1answer
131 views

Python script to copy first row of certain attributes and paste in the newly digitised rows the copied features

Starting from this question, I need a script to be insterted in the processing graphical modeler that can copy some attributes from the first digitised row in all the newly digitised lines of a ...
2
votes
2answers
143 views

Store in a python list the attribute table of a vector in QGIS

I'm stuck with a very simple issue.. I've loaded in QGIS (through the py console) a csv layer (no geometry) made of 4 fields and 3 rows: #load the csv layer = QgsVectorLayer("path/to/the/csv", ...
2
votes
2answers
107 views

How to find the irregular polygons in qgis using python

I have a vector shape file and i want to find the irregular polygons. What are the parameters to be considered to check the iregularity of the polygon features? Calculating the perimeter and extent ...
4
votes
5answers
384 views

Is there any simple integration for counting points in polygon using python qgis?

Is there any simple integration for calculating count of points in polygon using QGIS-Python integration? In other words, are there any pre-defined functions for points in polygon of QGIS using ...
1
vote
1answer
203 views

Can we count the points in polygon using pyqgis code? [duplicate]

Does anyone know how to calculate the point in polygon from the given points and the buffer output using python qgis. I have every thing loading the data and retrieving the output. But now I want to ...
1
vote
0answers
60 views

How to modify the “Network Analysis Library” in QGIS?

I want to modify the network analysis library because th graph builder does something I don't want. When there is an intersection between to lines, it creates a node in it. I want to avoid this ...
2
votes
0answers
194 views

Can we create buffer analysis using python in qgis?

Can we create a buffer of distance 0.004 using python in qgis. I tried this link, but it isn't working for python in qgis 2.10.1-Pisa. The above is the diagram of buffer I am asking. It's located ...
1
vote
1answer
82 views

pyQgis - set Variables on startup

via startup.py it is possible to execute python code when qgis starts. Now I wonder, whether it is possible to set variable values, eg. a string variable which holds a path or a dictionary of values, ...
7
votes
1answer
377 views

How to exit QGIS after running a python script?

I would like to run a python script via qgis --code myscript.py and then immediately exit. I'm using iface.actionExit().trigger(), which kills QGIS when I run it from the python console, but not when ...
1
vote
1answer
77 views

Unable to update some of the attributes using PyQGIS

I'm trying to create new attribute and populate it, but for unknown reason some of the features does not update while others are updated normally. # scores - list of values which length is equal to ...
2
votes
2answers
97 views

How can I access to elements in dir(some_class) of PyQGIS without a dictionary in my code?

I'm developing a QGIS plugin to search class methods in the different classes of PyQGIS. I used three widgets: 2 objects of type QLineEdit (for classes and class methods) and one QTextBrowser (for ...
0
votes
2answers
128 views

How to save layer as dbf using pyQGIS?

Is it possible to save layer as dbf? Or even better convert .csv to .dbf? I have some .csv files, no geometry just attributes and I need it as .dbf as I want to edit them (I found that Qgis doesn't ...
1
vote
0answers
76 views

How to load and execute python scripts from a local path after python console is triggered in QGIS?

I had created a file named "startup.py" in users python home directory (... .qgis2/python) and i had triggered the python console in startup.py file by import qgis ...
1
vote
0answers
82 views

PyQIS add values to QGIS qml style file

I wonder if it is possible to add new styles to a QGIS style qml file with categorized values programmatically. I have for example a large qml style file and want to add a new definition for ...
0
votes
1answer
54 views

How to use SpatialOperator in filter expression in QGIS

In a python script I want to specify a request filter expression using a spatial operator. I am following the general syntax "field name" operator condition. For example: ...
1
vote
0answers
72 views

Use cython in QGIS?

I've wondered for some time how to use Cython in QGIS. I know I can integrate a Cython code in python, but I want Cython to handle QGIS classes. QGIS is built upon QT, every qgis object is a qobject ...
0
votes
0answers
57 views

Error's while retrieving data from postgres to Qgis using python?

This is my code of python in qgis from qgis documentation docs uri = QgsDataSourceURI() uri.setConnection("localhost","5432","gis_data","postgres","vajja") ...
0
votes
0answers
49 views

GIS route creation from street names

I have a list of streets comprising 300+ routes. Each route (in text) lists 4-5 street names where the route should take place. I would like to create each route, that is, plot the street names and ...
1
vote
1answer
51 views

Create Plugin for Qgis 2.10 by using Eclipse

I finished to create my plugin and i compile it; I have : Myplugin.py, Myplugin_dialog.py, Myplugin_dialog_base.ui Is it in the Myplugin_dialog.py that i suppose to create new functions and add ...
2
votes
1answer
70 views

Difference between qgis.utils and qgis.core?

Please, can you tell me what is the difference between qgis.utils and qgis.core ? I'd like to understand step by step the QGIS API Document.