Python bindings for QuantumGIS (QGIS)
2
votes
1answer
715 views
TIN Interpolation using a vector layer
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 ...
2
votes
1answer
114 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 ...
5
votes
1answer
270 views
How to get pixel size/cell size of raster layer?
After much searching, I've still not been able to figure out how to perform what seems like a simple function: I'd like to get the pixel size/cell size of a raster layer using PyQgis. Is there any ...
9
votes
4answers
506 views
How to buffer in pyQGIS?
I'm looking for some examples to do simple python scripts in QGIS. How would I do a buffer analysis on a dataset?
I can't seem to find much in the manual and QGIS python that quite matches the Esri ...
3
votes
1answer
145 views
Why are the features in my memory layer not displayed?
I am trying to create a memory layer, I followed the directions from the page below but no points appeared on my map. First I tried typing each line into the python console and I also create a plugin ...
1
vote
1answer
474 views
rpy2 installation ERROR “Tried to guess R's HOME but no R command in the PATH”? [closed]
I tried to install rpy2 (pip install rpy2). I want to use the SDAPP4 extension with QGIS (QGIS shows up the message missing rpy2...). The system tells me always the same error: Tried to guess R's HOME ...
1
vote
1answer
97 views
QgsVectorDataProvider.createAttributeIndex() fails in QGis 1.8
Adding an Attribute Index to a Shapefile fails for a Python Plugin in QGIS:
For example - the following python Code in a Plugin
ly = QgsVectorLayer(data_source, layer_name,"ogr")
prov = ...
5
votes
1answer
328 views
How do I allow users to select features with the mouse?
I am using PyQGis API to create a custom application.
How do I allow users to select features with the mouse? Is there a mapTool for this? Surely with a product as powerful as QGis there must be.
...
5
votes
1answer
164 views
How to call GRASS modules in pyQGIS?
I wish to use a Grass module (v.to.db) in QGis, without the grass toolbox.
I tried with the Python console, but to no avail :
Using Sextante plugin but obviously it didn't know all the grass ...
1
vote
1answer
92 views
Is there a straight way to copy or clone a QgsVectorLayer Object?
Is there a straight way to clone or "deepcopy" a QgsVectorLayer Object with python? Unfortunately the python module "copy" is not successfull with that.
Thanks in advance!
nikolaus
1
vote
1answer
899 views
How can I fix “ImportError: No module named qgis.core”?
First of all, I'm using Python 2.7.3, QGIS 1.8 (Lisboa) on Windows 7 pro 64 bits. Now let's go to the actual question:
I have written some code (Python) that works well within the QGIS built in ...
2
votes
1answer
225 views
How to meet “Contour plugin” and “Profile Tool” dependencies in OSX?
So I have two similar but different issues than my previous question, one I may have mentioned already. When attempting to install the Contour plugin I am told I need matplotlib, which I have on my ...
2
votes
0answers
26 views
How can I set python path and version for QGIS? [duplicate]
Possible Duplicate:
Couldn’t load SIP Module
When I'm starting QGIS I'm getting the problem:
"Couldn't load SIP module. Python support will be disabled."
And there is also:
Python version: ...
2
votes
2answers
221 views
How to show a message box in QGIS?
I am starting to develop a plugin for Qgis using python, which i am very new at, and would like to view some results of variables by displaying a message in QGIS. How can I do this?
4
votes
2answers
170 views
How to iterate over selected layers?
In QGis by pressing shift or ctrl keys a user can select multiple layers in toc.
How can a python script iterate over selected layers?
I'd expect a iface.selectedLayers() but I can find only ...
2
votes
1answer
141 views
Can I Dynamically Update Symbol Ranges?
Background: I'm currently trying to dynamically change the ranges for a layer with new style graduated symbology.
Problem: I thought it may be as simple as updating the ranges for the existing ...
1
vote
2answers
109 views
How to do a spatial search without select() using PyQGIS?
Using QGIS 1.9.0-master, I want to do a spatial search for features in a vector layer without selecting them, i.e., without using QgsVectorLayer.select(), QgsVectorLayer.selectedFeatures() et al.
...
1
vote
1answer
96 views
Count the number of symbols in a 'new symbology' renderer from pyqgis
Background : I create a lot of symbology using 'saturation' ramps - for want of a better term, e.g. where the hue and value of each symbol stays the same, but the saturation changes. I couldn't figure ...
1
vote
0answers
47 views
What is the proper way to do an automatic rollback of a vector layer edit?
I'm trying to rollback automatically the changes in features of a in-memory vector layer that don't meet certain criteria.
The code I'm using for testing looks like this:
...
def some_function()
...
3
votes
1answer
241 views
Get extents of vector shape features in python
i am just wondering if it is possible to iterate through vector features and return the extent per feature without clipping the vector shape?
The code looks like this and comes from the ...
3
votes
1answer
203 views
Creating Selection MapTool in PyQgis Custom Application
I'm developing a custom GIS application using PyQgis API.
How can I let the user select features on the map using Maptools? I would like to replicate the select feature there in Qgis to make the ...
1
vote
0answers
97 views
Is there any python function to rotate map layers?
Is there any python function allowing a user to rotate map layers in the map canvas. If so, could you please point this out for me?
I want to rotate a map layer, using a factor of rotation in ...
2
votes
1answer
172 views
Is it possible to programmatically add calculated fields?
In the Memory provider described in PyQGIS Cookbook or in question How to create a new empty vector layer programmatically? I can see how to create a vector layer programmatically using standard ...
1
vote
2answers
150 views
Cannot get changeAttributeValues() to work in a loop
I'm trying to use QGIS to loop through a set of points, find their elevation from a DEM and use that value to update the point layer's attribute table. The loop works fine until I try to use ...
2
votes
2answers
240 views
How do I get the path of a project, or layer file in PyQGIS?
I am generating new raster files from vector layers on a project. I would like to save them in the same directory as the project or layer files. How do I find this path using PyQGIS?
1
vote
0answers
143 views
Qgis Plugin development with postgres data
can someone help me with initial developing on qgis plugin that displays postgres data table on a QTTableView or QTTableWidget?
So far:
I can connect to database using psycopg2 or using ...
1
vote
0answers
52 views
SVG markers with PyQGIS
How do you SVG-marker layers in PyQGIS? I'm importing a vector layer and want to display it with SVG-markers.
It seems that QgsSvgMarkerSymbolLayerV2 does not exist in PyQGIS...
1
vote
1answer
225 views
how to get the projection from a vectorlayer in qgis?
Hi I am trying to set the projection on a raster to match that of a vector point layer. Thus I need to findout what is the projection of a give layer, to use it in the GDAL.Dataset.SetProjection() so ...
0
votes
0answers
103 views
QGIS python console projection transformation
I need to write a python console script in QGIS to do the following:
1) convert a simple KMZ to a shape file format
2) reproject from WGS84 to British Grid (OSGB_1936)
This is to automate the 2 steps ...
4
votes
1answer
179 views
How to Create a raster layer from a numpy array using pyqgis?
I am working on a plugin for Qgis to calculate spatial Kernel density maps. I have all the calculations working, all I am missing is a way to turn a Numpy Array, with density values into a multiband ...
2
votes
1answer
412 views
QGIS: How to load feature (.qml) styles from python? [duplicate]
Possible Duplicate:
How to style a layer from console?
I'm trying to set the styles for a vector layer by loading the .qml file in the python console. The qml-style file contains all ...
2
votes
1answer
133 views
Is it possible to set a layer style (e.g. set the color ramp) before loading the layer using pyQGIS?
I am implementing a tool which allows an user to calculate some statistics with some data from the registration office. My question is, can I set some layer styles using pyQGIS?
The analysis part is ...
2
votes
1answer
284 views
How to split geometry collection into its items using Python and QGIS API?
I'm getting some geometries via intersecting lines by polygons (somewhat blindly - I don't really know if intersection exists and actually I don't need to know) using python and QGIS API: ...
0
votes
0answers
29 views
How to apply a symbology stored in a qml file? [duplicate]
Possible Duplicate:
How to style a layer from console?
I'm writing a plugin for QGIS and I want to apply a symbology (rules) stored in a QML file.
And I don't know how to do that :-/
...
0
votes
1answer
361 views
pyqgis: How to get features of selected geometries
I wonder if anybody could provide an example how to get the attributes of selected Features?
I tried the folowing Code in the python Console - but I'm stuck at the point where I'd like to get the ...
1
vote
1answer
119 views
Color depending on attribute
I'm trying to set the color of a vectorlayer feature depending on the feature attributes with PyQGIS. How do you acces the attributes of a vectorlayer feature?
2
votes
1answer
172 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 ...
3
votes
0answers
419 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, ...
0
votes
0answers
199 views
Qgis python plugins development with Eclipse
I'm using Eclipse's PyDev extension to develop python plugins for Qgis.
I did the required configs for the interpreter in Eclipse to be able to use python.
When I start a PyDev project, all the Python ...
3
votes
1answer
460 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 ...
6
votes
1answer
572 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 = ...
6
votes
1answer
353 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
144 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
99 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 ...
6
votes
1answer
985 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
370 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
264 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
419 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
67 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
238 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.
...
