Skip to main content

All Questions

Tagged with or
Filter by
Sorted by
Tagged with
18 votes
1 answer
14k views

Writing standalone Python scripts using PyQGIS?

I've been learning how to use the Python Console in QGIS using references from qgisworkshop.org. I'm familiar with writing standalone scripts in ArcGIS and want to learn how to do the same with QGIS. ...
djq's user avatar
  • 16.3k
7 votes
2 answers
5k views

Connecting PyQGIS plugin with PostgreSQL

I created a plugin in QGIS. Then I created a Qt GUI for my plugin and finally created a PostgreSQL database. Now I need to make a connection between Qt-GUI and PostgreSQL database. I wrote this: from ...
lisa's user avatar
  • 79
40 votes
3 answers
47k views

Running simple Python script for QGIS from outside

I would like to run a few small and simple Python scripts for QGIS (Mac) from "outside" of QGIS (e.g. Sublime Text). With outside I mean in this context, either the normal os command line (...
Benedikt Groß's user avatar
10 votes
1 answer
18k views

Getting feature count of QgsVectorLayer using PyQGIS?

I'm using this code to get features from QgsVectorLayer QgsVectorDataProvider* provider=theVectorLayer->dataProvider(); if(!provider) { return; ...
bossman's user avatar
  • 233
2 votes
1 answer
2k 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. ...
user8790's user avatar
1 vote
0 answers
58 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 write ...
luigi's user avatar
  • 11
6 votes
3 answers
3k 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 "...
Renaud's user avatar
  • 871
7 votes
2 answers
3k views

Loading 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 ...
Luca's user avatar
  • 71
9 votes
5 answers
3k 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 ...
mlt's user avatar
  • 357
3 votes
0 answers
1k 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): ...
Karthik Bharadwaj's user avatar
2 votes
1 answer
1k 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 ...
James S's user avatar
  • 4,304
6 votes
2 answers
5k 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 qgis....
Vadim's user avatar
  • 61
2 votes
1 answer
339 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)?
Cathrin's user avatar
  • 369
13 votes
1 answer
11k views

Adding button to the QGIS toolbar or create my own toolbar

I want to create a button and add it to the QGIS toolbar or alternatively create my own toolbar and add the button here. A plugin should be started when the user clicks the button.
Cathrin's user avatar
  • 369
3 votes
1 answer
548 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: /usr/lib/python2.7/dist-packages/qgis/...
Norm Trowell's user avatar
9 votes
3 answers
11k views

Specifying CRS of raster layer using PyQGIS

I am 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 ...
Renaud's user avatar
  • 871
6 votes
1 answer
3k views

Changing attribute data types using PyQGIS

I've already asked a question about how to access attribute data types when developing a plugin for QGIS, using PyQGIS. And one helpful member said I should use the pendingFields() method on the ...
kyuss's user avatar
  • 155
3 votes
1 answer
188 views

How to display a particular area?

I'm developing a plugin in Python for QGIS. I would like the user to select a particular area in a list (let's say a country list) and zoom in the map on the corresponding area. Actually I'm doing ...
Djabx's user avatar
  • 285
3 votes
2 answers
4k views

How to use gdal_contour in QGIS Python console?

Is there a way to use the gdal_contour utility within the Python console of QGIS?
Renaud's user avatar
  • 871
10 votes
1 answer
15k 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 ...
Renaud's user avatar
  • 871
9 votes
3 answers
8k views

Accessing attribute data type in PyQGIS

I've been developing a Plugin on the 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, the plugin ...
kyuss's user avatar
  • 155
2 votes
1 answer
580 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...
Djabx's user avatar
  • 285
4 votes
2 answers
2k 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?
Renaud's user avatar
  • 871
6 votes
1 answer
1k 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 ...
Germán Carrillo's user avatar
39 votes
5 answers
28k views

Iterating over map layers using PyQGIS

I'm having trouble figuring out how to iterate over map layers. I can access the currently highlighted layer in the table of contents via iface.activeLayer() but I want my code to operate on all ...
spencerrecneps's user avatar
15 votes
2 answers
19k views

Creating sectors for telecom towers

I work in the Mobile networks industry and i took up a task to create a plugin for QGIS using c++/python that does the following: step 1: Create points corresponding to each mobile tower based on Lat/...
Bavin's user avatar
  • 159
8 votes
2 answers
4k views

Getting pixel value using PyQGIS

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)
Maaksaa's user avatar
  • 81
3 votes
2 answers
3k views

Automating relative filepath when adding new toolbox to arcmap catalog?

I'm creating an arcpy script for a custom toolbox and I want to make it so that a user can essentially utilize the script in that toolbox without having to change the source path (which I made ...
Nightvein's user avatar
  • 145
4 votes
2 answers
2k 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 ...
user7172's user avatar
  • 1,529
4 votes
1 answer
780 views

How to move Layer to the 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 = QgsRasterLayer(...
Dimpflmoser's user avatar
1 vote
1 answer
1k views

How to handle geometry change in vector layer?

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 a ...
Djabx's user avatar
  • 285
4 votes
1 answer
576 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 ...
Roman Trubka's user avatar
1 vote
1 answer
306 views

Python in QGIS is missing SQL drivers in PyQT4

I am developing a QGIS plugin and need to create a table view in my GUI that I have been designing with QT Designer. I have PyQT4 installed but I have noticed that I have 2 Python directories. I have ...
Roman Trubka's user avatar
3 votes
2 answers
556 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 ...
ahoi's user avatar
  • 43
3 votes
1 answer
469 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 ...
tsw's user avatar
  • 31
1 vote
0 answers
431 views

Relative Path not working in ArcMap and ArcObjects

I'm using ArcMap 10.0 and Windows 7 64 bit. I'm trying to set a relative paths for my MXD file. My MXD is located at C:\workspace\rastertest.mxd and the data is located at C:\workstation\data\testdted....
Davidst95's user avatar
7 votes
4 answers
5k views

Using Spatial Query plugin from PyQGIS

Is it possible to reach the Spatial Query plugin functionality in QGIS from a Python script (PyQGIS)? If so, how do I accomplish this? Haven't found any documentation for it, even in the C++ API docs.
Andreas's user avatar
  • 101
2 votes
1 answer
1k views

Unmanaged Raster Catalog Relative Paths?

Is it possible to store relative paths in an unmanaged raster catalog? What I want to do: C:\Folder\File.gdb UnmanagedRasterCatalog1 ..\..\Data\MyRaster\Raster.File C:\Data MyRaster ...
Andy Arismendi's user avatar
0 votes
0 answers
1k views

Seeking resources for python scripting in QGIS? [duplicate]

Possible Duplicate: QGIS tutorials and resources I would like to know regarding the available resources for starting to learn about python scripting for QGIS.
SNT's user avatar
  • 3,409
18 votes
4 answers
30k views

Saving project with data source path as relative in QGIS?

Is there an option in QGIS to save the project with the data source being a relative path? I don't see the option here. QGIS Wroclaw1.7.3
SNT's user avatar
  • 3,409
4 votes
2 answers
2k views

Ensure relative path in Arcgis layer files

I'm looking for the arcgis python equivalent of the VBA How to save a layer file with a relative path. I'm using a script to change the paths in a collection of about 75 layer files before ...
matt wilkie's user avatar
  • 28.3k
2 votes
2 answers
695 views

Specifying a file for VirtualShape in SpatiaLite [closed]

I'm fairly very new to spatialite, and am stuck on something very basic. I'm creating a virtual table from a shapefile using virtualshape. This works fine when the shapefiles are in the same folder ...
Matthew Finlay's user avatar
9 votes
2 answers
2k views

How can I crawl directory tree and change Mxd relativePaths to true?

I have a large number of project folders where each project folder can have many subfolders. These subfolders can contain mxds, shapefiles, personal gdb's and fgdb's. In many cases the user forgot ...
Kirk Kuykendall's user avatar
27 votes
1 answer
8k views

Accessing 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 ...
mattwigway's user avatar
3 votes
1 answer
2k views

Solving QGIS error Python Plugin is Broken?

I tried following the steps to build a python plugin for QGIS. (step 3 is where I am stuck at) 1) I used the Plugin Builder plugin to build the initial set of files. I call my plugin "...
nerazzurri_4's user avatar
3 votes
2 answers
1k views

Getting composition name in QGIS Python console

In the QGIS python console, I want to populate a list with compositions names, like in Composer Manager, but I can't figure out how to get the names (titles). So far: composerlist = self.iface....
Pablo's user avatar
  • 9,865
3 votes
1 answer
267 views

Setting relative paths for KMZs in Arc2Earth dialog?

Using Arc2Earth, I'm converting a large vector dataset to a KML with regions. The resulting kmz works great on my computer but the files paths are all actual paths and not relative, so they don't ...
Jon Bonkoski's user avatar
3 votes
2 answers
7k views

Hyperlink relative paths to files in points layer in QGIS?

I would like to add hyperlinks to each point in a points layer in QGIS 1.7.0 running on Mac OS X 10.6.7, but I have several requirements: (1) Each hyperlink has to be a relative path to the linked ...
hpy's user avatar
  • 3,195
7 votes
2 answers
5k views

Clearing Python console in QGIS [duplicate]

After running several hundred lines of commands (and getting their subsequent error statements...), it is nice to be able to clear out the console window and start clean. In the Python Console ...
DavidF's user avatar
  • 4,862
10 votes
2 answers
6k views

Returning latitude and longitude of point using PyQGIS [closed]

I have a point layer, that I'd like to return the Longitude, latitude using the PyQGIS. How do I use QgsPoint to do that?
dassouki's user avatar
  • 8,563

1
154 155 156 157
158