Skip to main content

All Questions

Tagged with or
Filter by
Sorted by
Tagged with
9 votes
1 answer
5k views

Evaluating raster calculator expressions from console

How can I execute from the console an expression that should be used with the raster calculator? I'm searching for something like this: qgis.someRasterCalcClass.evaluate("boh@1 + boh@2", "outputfile....
diegogb's user avatar
  • 623
3 votes
1 answer
1k views

How to use QgsOverlayAnalyzer class in pyQGIS?

I am very new to Python scripting in QuantumGIS, so bear with me please. I am trying to use the QgsOverlayAnalyzer class in QuantumGIS (http://www.qgis.org/api/classQgsOverlayAnalyzer.html#details) ...
Dom's user avatar
  • 31
4 votes
4 answers
1k views

How to display a "Save As" dialog for raster files?

I'm writing a QGIS plugin in python. I need to show a "Save as" dialog window in order to allow the user to select the path of the output raster file. Do I need to create a QFileDialog and manually ...
diegogb's user avatar
  • 623
7 votes
1 answer
3k views

Deploying QGIS Python Standalone Application with minimum installation size

I am trying to create a Standalone QGIS Application using python. I was able to create the nice looking shapeviewer application by following the steps here. Now I would like to deploy this in another ...
vinayan's user avatar
  • 7,290
5 votes
2 answers
5k views

Setting up QGIS print composer options from Python console [closed]

If I have a print composer called "ABC", I would like to "tell" its composer that I would like to update "Map 0" to simulate the "set to map canvas extent" ...
n1kn0k's user avatar
  • 499
6 votes
1 answer
1k views

How to begin with tool development for GRASS gis or QGIS GRASS

I wanted to begin with customized tool development in Grass GIS or QGIS grass. How should i begin in to develop the tool. I search a lot in google search engine for begin with tool development in ...
Pari's user avatar
  • 610
29 votes
4 answers
59k views

Reading attribute values using PyQGIS

What is the way to get the information contained in the attribute table, say in column 2, row 2 using PyQGIS?
user16018's user avatar
  • 309
2 votes
2 answers
4k views

Where exactly are qgis.gui and qgis.core located?

I'm trying to create a standalone QGIS app using PyQGIS. I'll be deploying it by copying the install folder of QGIS and source folder of my app, and so for the testing purposes I copied QGIS install ...
U2ros's user avatar
  • 5,157
4 votes
1 answer
549 views

Personal shell launcher for PyQGIS

I have changed a shell launcher found at http://inasafe.linfiniti.com/html/id/developer-docs/platform_windows.html as to fit my wish: setting the system environment variables to be able to use PyQGIS ...
umbe1987's user avatar
  • 3,785
3 votes
0 answers
189 views

How to delete a point with known coordinates in python?

I was wondering if there is a piece of code that does the opposite that setGeometry does and removes a point if there is one at x and y coordinates?
NothingToSay's user avatar
1 vote
1 answer
387 views

How do you Select an existing vector Layer and Edit it, using python?

I'm developing a small plugin that needs to be able to select a vector layer programatically based on what layer the user has selected. However I'm not sure how to do so. I believe I found the two ...
NothingToSay's user avatar
12 votes
2 answers
7k views

Zooming from python console of QGIS

What are the commands to apply all types of zoom (full, on selected layer, etc.) in python console? I'm searching both on pyqgis cookbook and API documentantion, but I'm not finding anything ...
user15847's user avatar
  • 157
6 votes
3 answers
20k views

Extract coordinates from vector layer in PyQGIS

In QGIS, I have made a polygon, and from that polygon I have made a vector grid via research tools-> vector grid. The grid covers the entire polygon. Now I want to extract these grid points in the ...
Toke's user avatar
  • 379
4 votes
1 answer
710 views

How to auto-start a pyQGIS thread?

having build some (two) minor plugins, it's now time for me to link a few (perl-) applications to qgis. As there is no perl-interface in qgis I thought the best way to link both worlds together is a ...
Helmut Seidel M.A.'s user avatar
7 votes
1 answer
3k views

Handle add new feature event and/or access feature before commit?

Is it possible with PyQGIS to catch "add new feature" event before commiting changes on the layer? or at least to access new features before commit.
AlexSV's user avatar
  • 319
5 votes
1 answer
1k views

How change border line to no pen with python console?

From Python console I load a shapefile with qgis.utils.iface.addVectorLayer. How I can remove border lines (change to no pen) in the active layer?
gegestk's user avatar
  • 51
1 vote
1 answer
223 views

Get feature while editing

I have created my custom form for features editing, using layer.setEditForm("form.ui") and layer.setEditFormInit("init") properties. init method receives dialog, layerId and featId as arguments. ...
AlexSV's user avatar
  • 319
3 votes
2 answers
2k views

Merging polygons at county level to state level?

I have a shapefile that represents counties (admin 2) only, but I need to create a state level (admin 1) polygon file (I'm using QGIS). I will need to sum up (or average) the relevant data at each ...
swit01's user avatar
  • 31
5 votes
1 answer
583 views

How to get a list of all projections that are currently available in QGIS via the PyQGIS-API

i'm building a QGIS-Plugin and i want the user to choose a CRS out of a combobox in which the coordinates he would enter into some textfields are represented, so these can be converted into another ...
Docnaut's user avatar
  • 105
1 vote
1 answer
1k views

How to save an existing LYR file to use a relative path *and* have the LYR be v9.3 compatible?

Not sure if this is possible - I am writing a python script to convert LYR files to use relative paths and save the LYR as a 9.3 LYR file. I can do each one individually, but not together. ... # ...
Jesse Cleary's user avatar
8 votes
2 answers
3k views

How do I use QGIS python console to iterate through simple layer queries and png outputs?

I'm really new to QGIS coding and I'm having a hard time finding (especially) the api classes/functions to carry out actions of the Query Builder window. I'm basically trying to do this: Iterate ...
Kory Roberts's user avatar
1 vote
1 answer
3k views

How do I copy all feature attributes to a feature in a new layer?

I'm trying to create a new layer in QGIS based on an existing layer. The new features should have all the attributes of the corresponding features in the original layer. I've been trying to use ...
Jake's user avatar
  • 6,934
8 votes
1 answer
7k views

Applying graduated renderer in PyQGIS? [closed]

Just trying to run the following code already given in the pyqgis cookbook to create graduated colors symbology (as in example with 2 classes) I define the source info for the shapefile but when I ...
cempro's user avatar
  • 654
1 vote
1 answer
1k views

Why do I get 'KeyError: 0' when using Line Intersection tool?

I'm using Quantum GIS version 1.8.0-Lisboa and trying to create intersection point using Intersection tool. (Vector -> Analysis tools -> Line Intersections ) But when I do that for my shapefile, It ...
Sibi's user avatar
  • 1,097
1 vote
1 answer
769 views

Persisting ArcGIS Network Analysis Route Layer?

I'm using ArcGIS 10.0. I'd like to be able to specify the location (path) where to create the route layer, for network analysis, when I click on Network Analysis -> New Route. Is that possible? ...
yo_haha's user avatar
  • 1,137
1 vote
0 answers
413 views

DLL problem with PyQGIS

I am having problems with Python Shell importing the module "qgis.core". When I type "import qgis.core" the Shell ("idle.pyw") gives me this error: Traceback (most recent call last): File "<...
umbe1987's user avatar
  • 3,785
4 votes
1 answer
3k views

Getting dataProvider from vector layer outside QGIS

I'm using PyScripter to explore PyQGIS API because of it's very handy auto-completion function. I've managed to get a handle on a PostGis vector layer by: >>> from qgis.core import * >&...
spingerfitz's user avatar
12 votes
1 answer
23k views

How do I maintain a resposive GUI using QThread with PyQGIS

I have been developing some batch processing tools as python plugins for QGIS 1.8. I have found that while my tools are running the GUI becomes non-responsive. The general wisdom is that the work ...
Kelly Thomas's user avatar
  • 1,494
5 votes
1 answer
5k views

Setting up Python to recognize QGIS

I want to use QGIS and work with Python out of the console, but I'm having troubles letting the system recognize the paths of some DLLs. Since I couldn't find a good answer on the web, I wonder if I ...
umbe1987's user avatar
  • 3,785
3 votes
1 answer
512 views

Join GPS points obtained from .GPX file in Python Console

Having loaded the .gpx file into a new layer from python console, I'm unable to access the gps points in the attributes table. Essentially, i'm unable to join these points to form a polygon (buildings)...
Allen's user avatar
  • 105
7 votes
1 answer
402 views

Unable to load .gpx file from Python Console

I'm trying to create a plugin which will extract the gpx files and load them onto the active layer window in QGIS. While I'm able to load it using the QGIS GUI from Layer>New Vector Layer, I'm not ...
Allen's user avatar
  • 105
10 votes
3 answers
10k views

Using QGIS Zonal Stats Plugin from Python Console?

I am using the Zonal Stats plugin in QGIS to extract raster statistics from overlaying polygons (I have shapefiles of species distribution and I want to extract environmental data from within each ...
Thomas's user avatar
  • 567
25 votes
3 answers
17k views

Programatically check for mouse click in PyQGIS

I want to know how to check for a mouse click in QGIS. I am trying to write a Python plugin and want to provide functionality similar to the "Select Single Feature" tool that already exists ...
robert's user avatar
  • 375
9 votes
1 answer
6k views

How to transform a selected multipart feature into singlepart features while editing in QGIS?

There are several questions and respective answers for how to make a multipart features Layer into a singlepart features one using QGIS: How to break a single polygon into multiple polys? How to ...
Alexandre Neto's user avatar
5 votes
0 answers
187 views

Is there a way to run the spatial query plugin from QGIS python console? [duplicate]

I want to get all contiguous polygons for every county. In QGIS I can do this manually with a Spatial Query, but for a large data set this result impractical. Is there a way to run the spatial query ...
Masat's user avatar
  • 51
5 votes
1 answer
356 views

QGIS projects - collaboration on different platform

On my computer, I have both - Ubuntu and Windows - operating systems. Since I work on both of them and QGIS save path to particular layers using absolute path, it's very inconvenient to store ...
matandked's user avatar
  • 681
4 votes
1 answer
411 views

Button to add a new line in a non-spatial table without opening the table itself using QGIS?

While using QGIS and having loaded a non spatial table (from PostGIS), is it possible to add a new row to its table attributes without having to open the attribute table first as in here Is it ...
André Barriguinha's user avatar
7 votes
1 answer
1k views

Adding entries to layerlist context menu using PyQGIS

I am implementing a Python based plugin for use with QGIS 1.8. Most of it's user interface is contained within a QDockWidget but there are some layer specific controls I would like to append to the ...
Kelly Thomas's user avatar
  • 1,494
2 votes
1 answer
183 views

QGIS 1.8 compiled against PyQt 4.8+? [closed]

I'm currently running QGIS on Win7 64bit. My installation says it was compiled against and running against PyQt 4.7.1, although according to the Osgeo4W installer and PyQt4.QtCore.PYQT_VERSION_STR, I ...
alex's user avatar
  • 103
15 votes
2 answers
4k views

Hiding/showing QgsVectorLayer using PyQGIS

Once created a layer, how can I hide/show it? I can enable/disable the rendering of a specific layer by selecting the checkbox through QGIS, but I need to do it programmatically with PyQGIS. How can I ...
Heisenbug's user avatar
  • 903
2 votes
2 answers
3k views

How to fix QGIS PyQGIS package?

I have a broken package that is preventing QGIS from loading python plugins, updating itself, or even un-installing. The main symptom of this problem is the following message that appears when QGIS ...
RobinLovelace's user avatar
3 votes
3 answers
4k views

Changing cursor shape in PyQGIS

I noticed that PyQGIS has QgsMapToolPan() and QgsMapToolZoom() functions, and the cursor shape on the canvas will change to a hand (for pan), magnifying-glass(+/-) (for zoomIn / zoomOut). I have a ...
Whospal's user avatar
  • 161
3 votes
1 answer
820 views

Why shapefile loaded in canvas always appear in random color?

I created the simple frame .UI file, compiled with pyuic4, and tried the ShapeViewer.py to load the shapefile "world_borders.shp". However, the map is always loaded in different random colors every ...
Whospal's user avatar
  • 161
9 votes
2 answers
883 views

How do you obtain the execution times of processes in qgis?

I am working on QGIS. I need to determine how much time QGIS needed to finish a specific task. I have been unable to get execution times for the processes. What is the proper way to get processing ...
Juan Barrios's user avatar
14 votes
1 answer
11k views

Removing QgsVectorLayer from QGIS plugin

I managed to add QgsVectorLayer in QGIS through a Python plugin, for example: vl = self.iface.addVectorLayer(uri.uri(), layerName, self.dbConn.getProviderName()) But how can I remove it?
Heisenbug's user avatar
  • 903
5 votes
1 answer
833 views

Can I use QGIS plugins in PyQGIS as a stand alone script without iface?

Can I use a qgis plugin especially (openlayers plugin) in stand alone pyqgis script? I don't find examples, just code using iface but that cannot used in stand alone script.
Joys's user avatar
  • 101
4 votes
2 answers
4k views

How to debug 'Layer is not valid error' from Python plugin?

I'm trying to understand what goes wrong with a QGIS python plugin. Basically I'm trying to render a series of POINT. The query works fine, at least giving it by hand from inside PostGIS DB: "SELECT ...
Heisenbug's user avatar
  • 903
2 votes
1 answer
5k views

TIN Interpolation using vector layer [closed]

I'm writing a plugin in QGIS and I'd like to generate a TIN surface using a vector layer with x,y and z (interpolation attribute). The idea is to visualize the same result like in the Interpolation ...
Steffy's user avatar
  • 21
14 votes
1 answer
6k views

How to create text labels with background boxes?

I'm trying to create some custom labels for point features in a QGIS point vector layer, and I want to write a python plugin to do it. We need our labels to be presented with color tinted rectangles ...
MonsterMushroom's user avatar
2 votes
1 answer
763 views

How to move the QGIS Layerpanel/Dockwidget programmatically

i'm working on a QGIS-plugin and want to move the default LayerPanel/Dockwidget to somewhere else programmatically. More specific: i want to move it into a tab of my tabwidget. Is this possible? How ...
Docnaut's user avatar
  • 105