Python bindings for QGIS.

learn more… | top users | synonyms

2
votes
1answer
232 views

Is there an itemSelectionChanged Signal in Attribute Table?

The QgsVectorLayer class emits a selectionChanged() signal . If a QGIS user for example selects a record in the Attribute Table of a Vector Layer - a selectionChanged() signal is emitted an can be ...
4
votes
1answer
903 views

How to find all intersections and count lines arriving at each intersection?

I'm having a hard time getting off the ground with this, and am trying to move away from ArcGIS / arcpy. I have a shapefile with a network of polylines. I want to find/count all 2-way intersections, ...
5
votes
1answer
1k views

How can i obtain the data of one selected feature in QGIS using python?

I have a problem / question regarding python and QGIS. Is it, and yes how, possible to get the data of one selected feature in QGIS using python? In my example I have a layer which shows some parcels ...
9
votes
1answer
1k views

When iterating over a vector layer with pyqgis, how do I check whether a feature is selected?

While iterating over a vector layer using the following code (summerized from the example in the pyqgis cookbook), is there a way to check whether a feature is selected? provider = ...
7
votes
1answer
790 views

How to add a toolbar via python?

Through tutorials I learned how to add a toolbutton to the plugins-toolbar via python. Now I wonder how to add a complete toolbar with toolbarbuttons via python. Can anybody give some example-code? ...
1
vote
0answers
203 views

no module named core

Hi I am trying to access and use QGIS modules/class/methods from IDLE on a mac. I have had the same problem as a few other people, and browsing the forums have tried to follow the advice they have ...
0
votes
0answers
140 views

How to build QGIS with Python on Redhat?

I'm attempting to run QGIS on Redhat 5 64 bit architecture. Version of Python is 2.4.3. Version of QGIS is 1.7.4 (wroclaw). When I run qgis, the splash screen appears, followed by a QMessageBox that ...
11
votes
2answers
3k views

How to create a new empty vector layer programmatically?

I am new to python and QGIS. I have looked at a few tutorials of python scripts for QGIS. All of them create new vector and raster layers with some existing data source. eg. shapefile or geotiff or ...
2
votes
0answers
770 views

legend groups and layer position/order qgis 1.8

I'm tring to programmatically create layer sequence also using groups. Simple python code: layer = QgsVectorLayer("004cp000.shp", "004cp000", "ogr") QgsMapLayerRegistry.instance().addMapLayer(layer) ...
1
vote
0answers
501 views

How to change feature's geometry?

Hy, I'm creating my layer like this: crs = core.QgsCoordinateReferenceSystem(4326, core.QgsCoordinateReferenceSystem.EpsgCrsId) uri = "Polygon" uri += '?crs=' + crs.authid() uri += ...
0
votes
1answer
636 views

Is getting wrong attribute values from a feature in qgis

I make two polylines features(in my example both consists of two points) with the add feature tool. Then I (with code) add some attribute values on the first feature, then changes the geometry of the ...
2
votes
1answer
70 views

Which class should I use to work with vector layers?

I'm doing different operations on vector layers. Kindly suggest which class should I use for vector layer i.e QgsVectorLayer or QgsVectorLayerDataProvider.
1
vote
1answer
424 views

How to get a signal when the geometry to a line in QGIS is changed

I am working on a plugin in QGIS and want to get a signal when the geometry to a feature(in this case a polyline) in my layer is changed. For example if I use the node tool to drag one of the nodes. ...
1
vote
0answers
33 views

qgis.core error [duplicate]

Possible Duplicate: qgis.core import error I am new in quantum gis and python, I installed quantum gis 1.8 from osgeo4w installer, after I installed python 2.7 and started python shell and ...
4
votes
2answers
301 views

How do I specify the position, style and units of the ScaleBar in pyqgis?

I would like to add a scale bar to my composition using the python console and then export it to a raster image. I am following the MapRendering tutorial with the "output using map composer " approach ...
2
votes
1answer
437 views

How to load a postgres view using pyQgis?

Under Qgis 1.8 on Windows 7 I have this problem with my pyArchInit plugin: I need to load on the map canvas my geometries from a postgis layer. Till the 1.7.4 version I use the method explained on the ...
8
votes
4answers
1k views

How to run sextante algorithms outside of qgis python console?

I'm kind of stuck trying to figure out the way to run sextante from a standalone python from OSGeo4W distribution. The reason I want to do this is that I got tired entering parameters in the dialog ...
2
votes
1answer
719 views

qgis.core import error

I would want to use the Qgis api for custom desktop application. When I imported the qgis.core module, I get the following error >>> import qgis.core Traceback (most recent call last): ...
1
vote
1answer
224 views

QGIS Updating composer label text via python - problem with Item Properties panel

I am writing a plugin that replaces the text of a composer label based on its itemID. When I change the text of the label using: item.setText("Hello World") the label changes on the composer but ...
1
vote
2answers
1k views

Problem loading vector layer (pyQGIS)

I've installed the qgis on ubuntu 12.04 following the instructions on http://hub.qgis.org/projects/quantum-gis/wiki/Download. I am trying to test the Python API and try to do the follwoing from ...
2
votes
1answer
193 views

How can i include program form (created in Designer ) to my QGIS plugin?

How can I include a form created in Designer in my QGIS plugin? And how to get controls values (textbox,label,etc)?
2
votes
1answer
1k views

How can I add button to the QGIS toolbox or create my own toolbox?

I want to create a button and add it to the QGIS toolbox or alternatively create my own toolbox and add the button here. A plugin should be started when the user clicks the button.
2
votes
1answer
200 views

Can't load PYQGIS

I get this error; any comments Couldn't load PyQGIS. Python support will be disabled. Traceback (most recent call last): File "", line 1, in ImportError: ...
3
votes
2answers
1k views

How can I specify the CRS of a raster layer in pyqgis?

I manipulating netcdf raster data from the QGIS python console. The metadata of my netcdf file does not provide the Reference system. However I know it is 'EPSG:4326' I am writing a python script to ...
3
votes
1answer
579 views

Changing attribute data types using PyQGIS

OK, so I've already asked a question how to access attribute data types when developing plugin for QGIS, using PyQGIS. And one helpful member said i should use pendingFields() method on the current ...
3
votes
1answer
144 views

How to display a particular area?

Hy, I'm developing a plugin in python for Qgis. I would like the user to select a particular area in a list (let say a country list) and zoom in the map on the corresponding area. Actually I'm ...
3
votes
1answer
974 views

How to use gdal_contour in QGIS Python console?

Is there a way to use the gdal_contour utility with-in the python console of qgis ? Thank you
5
votes
1answer
1k views

Why can't I import my script from the python console?

i am working with the qgis python console. I usually store all my python scripts into ~/Scripts/python I do have set the PYTHONPATH to ~/Scripts/python in my .bashrc However, I can not manage to ...
2
votes
2answers
2k views

How to access attribute data type in QGIS?

I've been developing a plugin on QGIS platform using PyQGIS. So far plugin does the following: You can select any feature of the already loaded vector layer in QGIS. After selection, plugin displays ...
2
votes
1answer
272 views

How to connect QGIS to a WMS-C with python?

I would like to connect my QGis to a WMS-C server when my python plugin load. How can I do that ? BTW, the method: addRasterLayer do not seams to handle WMS-C layer...
4
votes
1answer
576 views

How can I add OpenLayers layer from the python console?

I am new to the python console. How can I add a layer from the OpenLayers plugin from the python console? Thank you
2
votes
1answer
412 views

How to display local file's geometries as rubber bands in QGIS

I'd like to get geometries from a local file (e.g. GML) displayed as rubber bands (QgsRubberBands) in QGIS. However, I wouldn't like to load the layer into the map because in the real scenario there ...
3
votes
1answer
709 views

Get a pixel value

How can i do this operation: I want to get a pixel value fro the satellite image (Landat, GeoTIFF, 7 bands) using qgis-python. What operators should i use? (for example in qgis's Python Console) ...
1
vote
1answer
532 views

How to translate ESRI cursor example to pyQgis?

For example, how to translate this code into pyqgis? rows = gp.UpdateCursor("D:/St_Johns/data.mdb/roads") row = rows.Next() while row: row.buffer_distance = row.road_type * 100 ...
3
votes
1answer
276 views

How to move Layer to back?

from my Plugin I've loaded a rasterlayer using the following code: fileName = "/path/to/raster/file.tif" fileInfo = QFileInfo(fileName) baseName = fileInfo.baseName() rlayer = ...
1
vote
1answer
265 views

How to handle geometry change in Vector Layer?

Hy, I'm building a plugin in python that manage some lists of wkt from different intern sources (web services, bd, etc..). I can display every source without any problem. For displaying them, I use ...
2
votes
0answers
133 views

Setting border-style to 'no pen' using QgsGraduatedSymbolRendererV2

I am developing a QGIS plugin that, after a series of inputs, will produce a thematic map using the QgsGraduatedSymbolRendererV2. Because the polygon are very small, the boarders make it such that ...
0
votes
2answers
193 views

extract edge of a line of a vector layer in a new point layer [closed]

I'm using python to build a plug-in in Qgis. I need to extract the edges of each line feature of a vector layer to create a new point layer of all edges. Someone can help me? My data input is a vector ...
3
votes
2answers
141 views

How can I read the settings for the QgsPaperItem from XML?

I saved a template qpt for the map composer and now I want to read all the settings. I am able to insert the items with composition.addItemsfromXML... But this doesn't load the settings for the ...
2
votes
1answer
310 views

How to add Real Attributes to Shapefile using pyqgis?

I created the Qmarxan plugin using the fTools plugin as an example base. When I create a new shapefile using the QgsVectorFileWriter function I don't have any difficulty specifying a "Real" field with ...
10
votes
1answer
819 views

Is there a way to access QGIS plugins in Python?

Is there a way to access QGIS plugins in Python? I'd like to write a script to do some geoprocessing, and I'd like to use the clip, regular points and convex hull tools in fTools, as well as the Road ...